home *** CD-ROM | disk | FTP | other *** search
/ Languguage OS 2 / Languguage OS II Version 10-94 (Knowledge Media)(1994).ISO / gnu / mm-1_07.lha / mm-1.07 / tmac.m.old < prev    next >
Text File  |  1992-11-19  |  53KB  |  2,375 lines

  1. .\"    Version:
  2. .ds RE 1.06
  3. .ig
  4. Copyright (C) 1991 Free Software Foundation, Inc.
  5. mgm is written by J÷rgen HΣgg (jh@efd.lth.se)
  6.  
  7. mgm is free software; you can redistribute it and/or modify it under
  8. the terms of the GNU General Public License as published by the Free
  9. Software Foundation; either version 1, or (at your option) any later
  10. version.
  11.  
  12. mgm is distributed in the hope that it will be useful, but WITHOUT ANY
  13. WARRANTY; without even the implied warranty of MERCHANTABILITY or
  14. FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  15. for more details.
  16.  
  17. You should have received a copy of the GNU General Public License along
  18. with groff; see the file LICENSE.  If not, write to the Free Software
  19. Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
  20.  
  21.  
  22. Almost complete. The letter format is not included.
  23. Maybe as a separate package.
  24. Should be better as time goes.
  25.  
  26. Please send bugreports with examples to jh@efd.lth.se.
  27.  
  28. Naming convention stolen from mgs.
  29. Local names    module*name
  30. Extern names    module@name
  31. Env.var        environ:name
  32. Index        array!index
  33. ..
  34. .warn
  35. .\" ####### init ######
  36. .\"    Contents level [0:7], contents saved if heading level <= Cl
  37. .nr Cl 2
  38. .\"    Eject page between LIST OF XXXX if Cp == 0
  39. .nr Cp 0
  40. .\"    Debugflag
  41. .if !r D .nr D 0
  42. .\"    Eject after floating display is output [0:1]
  43. .nr De 0
  44. .\"    Floating keep output [0;5]
  45. .nr Df 5
  46. .\"    space before and after display if == 1 [0:1]
  47. .nr Ds 1
  48. .\"    Eject page
  49. .nr Ej 0
  50. .\"    Eqation lable adjust 0=left, 1=right
  51. .nr Eq 0
  52. .\"    Em dash string
  53. .ds EM \-
  54. .\"    Footnote spacing
  55. .nr Fs 1
  56. .\"    H1-H7    heading counters
  57. .nr H1 0 1
  58. .nr H2 0 1
  59. .nr H3 0 1
  60. .nr H4 0 1
  61. .nr H5 0 1
  62. .nr H6 0 1
  63. .nr H7 0 1
  64. .\"    Heading break level [0:7]
  65. .nr Hb 2
  66. .\"    heading centering level, [0:7]
  67. .nr Hc 0
  68. .\"    header format
  69. .ds HF 2 2 2 2 2 2 2
  70. .\"    heading temp. indent [0:2]
  71. .\"    0 -> 0 indent, left margin
  72. .\"    1 -> indent to right , like .P 1
  73. .\"    2 -> indent to line up with text part of preceding heading
  74. .nr Hi 1
  75. .\"    header pointsize
  76. .ds HP 0 0 0 0 0 0 0
  77. .\"    heading space level [0:7]
  78. .nr Hs 2
  79. .\"    heading numbering type
  80. .\"    0 -> multiple (1.1.1 ...)
  81. .\"    1 -> single
  82. .nr Ht 0
  83. .\"    Unnumbered heading level
  84. .nr Hu 2
  85. .\"    hyphenation in body
  86. .\"    0 -> no hyphenation
  87. .\"    1 -> hyphenation 14 on
  88. .nr Hy 1
  89. .\"    text for toc, selfexplanatory. Look in the new variable section
  90. .ds Lf LIST OF FIGURES
  91. .nr Lf 1
  92. .ds Lt LIST OF TABLES
  93. .nr Lt 1
  94. .ds Lx LIST OF EXHIBITS
  95. .nr Lx 1
  96. .ds Le LIST OF EQUATIONS
  97. .nr Le 0
  98. .\"    List indent, used by .AL
  99. .nr Li 6
  100. .\"    List space, if listlevel > Ls then no spacing will occur around lists.
  101. .nr Ls 99
  102. .\"    Numbering style [0:5]
  103. .nr N 0
  104. .\"    numbered paragraphs
  105. .\"    0 == not numbered
  106. .\"    1 == numbered in first level headings.
  107. .nr Np 0
  108. .\"    Format of figure,table,exhibit,equation titles.
  109. .\"    0= ". ", 1=" - "
  110. .nr Of 0
  111. .\"    paragraph indent
  112. .nr Pi 5
  113. .\"    paragraph spacing
  114. .nr Ps 1
  115. .\"    paragraph type
  116. .\"    0 == left-justified
  117. .\"    1 == indented .P
  118. .\"    2 == indented .P except after .H, .DE or .LE.
  119. .nr Pt 0
  120. .\"    Reference title
  121. .ds Rp REFERENCES
  122. .\"    Display indent
  123. .nr Si 5
  124. .\"
  125. .ds Tm \(tm
  126. .\"
  127. .\"---------------------------------------------
  128. .\"    Internal global variables
  129. .\"
  130. .\" These two are for cover macro .MT
  131. .\" Change @langage in the national file.
  132. .ds @cur-lib /usr/local/lib/groff/tmac
  133. .\" .ds @language
  134. .\"    Current pointsize and vertical space, always in points.
  135. .nr @ps 10
  136. .nr @vs 12
  137. .\"    Page length
  138. .ie r L .nr @pl \n[L]
  139. .el .nr @pl 11i
  140. .\"    page width
  141. .ie r W .nr @ll \n[W]
  142. .el .nr @ll 6i
  143. .\"    page offset
  144. .ie r O .nr @po \n[O]
  145. .el .nr @po 1i
  146. .\"
  147. .\" cheating...
  148. .\".pl 100i
  149. .pl \n[@pl]u
  150. .ll \n[@ll]u
  151. .lt \n[@ll]u
  152. .po \n[@po]u
  153. .nr @cur-ll \n[@ll]
  154. .\"---------------------------------------------
  155. .\"    New variables
  156. .\"
  157. .\" Appendix name
  158. .ds App APPENDIX
  159. .\" print appendixheader, 0 == don't
  160. .nr Aph 1
  161. .\"
  162. .\" header prespace level. If level <= Hps, then two lines will be printed
  163. .\" before the header instead of one.
  164. .nr Hps 1
  165. .\"
  166. .\" These variables controls the number of lines preceding .H.
  167. .\" Hps1 is the number of lines when level > Hps
  168. .nr Hps1 0.5v
  169. .if n .nr Hps1 1v
  170. .\"
  171. .\" Hps2 is the number of lines when level >= Hps
  172. .nr Hps2 1v
  173. .if n .nr Hps2 2v
  174. .\"
  175. .\" flag for mkindex
  176. .if !r Idxf .nr Idxf 0
  177. .\"    Change these in the national configuration file
  178. .ds Lifg Figure
  179. .ds Litb TABLE
  180. .ds Liex Exhibit
  181. .ds Liec Equation
  182. .ds Licon CONTENTS
  183. .\"
  184. .\" Lsp controls the height of an empty line. Normally 0.5v
  185. .nr Lsp 0.5v
  186. .if n .nr Lsp 1v
  187. .ds MO1 January
  188. .ds MO2 February
  189. .ds MO3 March
  190. .ds MO4 April
  191. .ds MO5 May
  192. .ds MO6 June
  193. .ds MO7 July
  194. .ds MO8 August
  195. .ds MO9 September
  196. .ds MO10 October
  197. .ds MO11 November
  198. .ds MO12 December
  199. .\" for GETR
  200. .ds Qrf See chapter \\*[Qrfh], page \\*[Qrfp].
  201. .\"    test for mgm macro. This can be used if the text must test
  202. .\"    what macros is used.
  203. .nr .mgm 1
  204. .\"
  205. .\"---------------------------------------------
  206. .\" set local variables.
  207. .ie d @language .mso mm/\\*[@language]_locale
  208. .el .mso mm/locale
  209. .\"---------------------------------------------
  210. .if \n[D] .tm Groff mm, version \*[RE].
  211. .\" ####### module init ######
  212. .\"    reset all things
  213. .de init@reset
  214. .ie \\n[misc@adjust] 'ad
  215. .el 'na
  216. .ie \\n[Hy] 'hy 14
  217. .el 'nh
  218. 'in 0
  219. 'ti 0
  220. 'ps \\n[@ps]
  221. 'vs \\n[@vs]
  222. ..
  223. .de @error
  224. .tm ******************
  225. .tm ERROR:(\\n[.F]) input line \\n[.c]:\\$*
  226. .if \\n[D] .backtrace
  227. .tm ******************
  228. .ab
  229. ..
  230. .\" ####### module debug #################################
  231. .de debug
  232. .tm \\$1:\\n[.F]:\\n[c.] ll=\\n[.l] vs=\\n[.v] ps=\\n[.s],\\n[.ps] \
  233. in=\\n[.i] fi=\\n[.u] .d=\\n[.d] nl=\\n[nl] pg=\\n[%]
  234. ..
  235. .de debug-all
  236. .nr debug*n 1n
  237. .nr debug*m 1m
  238. .tm \\$1:\\n[.F]:\\n[c.] ll=\\n[.l] vs=\\n[.v] ps=\\n[.s] in=\\n[.i]\
  239.  ad=\\n[.j] fi=\\n[.u] pl=\\n[.p] page=\\n[%] .o=\\n[.o]
  240. .tm _______ .d=\\n[.d] .f=\\n[.f] .h=\\n[.h] .k=\\n[.k] .n=\\n[.n]\
  241.  .p=\\n[.p] .t=\\n[.t] .z=\\n[.z] nl=\\n[nl] dn=\\n[dn] n=\\n[debug*n]
  242. ..
  243. .\" ####### module par #################################
  244. .nr par@ind-flag 1            \" indent on following P if Pt=2
  245. .nr hd*last-pos -1
  246. .nr hd*last-hpos -1
  247. .nr par*number 0 1
  248. .af par*number 01
  249. .nr par*num-count 0 1
  250. .af par*num-count 01
  251. .\"    reset numbered paragraphs, arg1 = headerlevel
  252. .de par@reset-num
  253. .if \\$1<3 .nr par*num-count 0
  254. .if (\\$1=1)&(\\n[Np]=1) .nr par*number 0
  255. ..
  256. .\"------------
  257. .\" paragraph
  258. .de P
  259. .\"    skip P if previous heading
  260. .ie !((\\n[nl]=\\n[hd*last-pos]):(\\n[nl]=(\\n[hd*last-pos]-.5v))) \{\
  261. .    if \\n[D]>2 .tm Paragraph 
  262. .    par@doit \\$*
  263. .\}
  264. .el .if !(\\n[hd*last-hpos]=\\n[.k]) \{\
  265. .    if \\n[D]>2 .tm Paragraph 
  266. .    par@doit \\$*
  267. .\}
  268. ..
  269. .de par@doit
  270. .SP \\n[Ps]/2u
  271. .ie  \\n[.$] \{\
  272. .    if \\$1=1 .ti +\\n[Pi]n
  273. .\}
  274. .el \{\
  275. .    if \\n[Pt]=1 .ti +\\n[Pi]n
  276. .    if (\\n[Pt]=2)&\\n[par@ind-flag] .ti +\\n[Pi]n
  277. .\}
  278. .if \\n[Np] \{\
  279. \\n[H1].\\n+[par*number]\ \ \c
  280. .\" $$$ 'br
  281. .\}
  282. .nr par@ind-flag 1
  283. ..
  284. .\" ####### module line #######################################
  285. .de SP
  286. .br
  287. .if !r line*lp\\n[.z] .nr line*lp\\n[.z] 0
  288. .if !r line*ac\\n[.z] .nr line*ac\\n[.z] 0
  289. .ie \\n[.$] .nr line*temp (v;\\$1)
  290. .el .nr line*temp 1v
  291. .\"
  292. .ie \\n[line*lp\\n[.z]]=\\n[.d] \{\
  293. .    \" go here if no output since the last .SP
  294. .    nr line*output \\n[line*temp]-\\n[line*ac\\n[.z]]
  295. .    if \\n[line*output]<0 .nr line*output 0
  296. .    nr line*ac\\n[.z] +\\n[line*output]
  297. .\}
  298. .el \{\
  299. .    nr line*ac\\n[.z] \\n[line*temp]
  300. .    nr line*output \\n[line*temp]
  301. .    \" no extra space in the beginning of a page
  302. .    if (\\n[.d]<0):(\\n[pg*head-mark]=\\n[.d]) .nr line*output 0
  303. .\}
  304. .if \\n[line*output] .sp \\n[line*output]u
  305. .nr line*lp\\n[.z] \\n[.d]
  306. ..
  307. .\" ######## module misc ###############
  308. .nr misc@adjust 14
  309. .de SA
  310. .if \\n[.$] \{\
  311. .    if \\$1-1 .@error "SA: bad arg: \\$1"
  312. .    nr misc@adjust 0\\$1
  313. .\}
  314. .ie \\n[misc@adjust] 'ad
  315. .el 'na
  316. ..
  317. .\"-------------
  318. .\" switch environment, keep all important settings.
  319. .de misc@ev-keep
  320. .nr misc*ll \\n[.l]
  321. .ev \\$1
  322. .ll \\n[misc*ll]u
  323. .lt \\n[misc*ll]u
  324. ..
  325. .\"-------------
  326. .\" .misc@push stackname value
  327. .de misc@push
  328. .ie d misc*st-\\$1 .ds misc*st-\\$1 \\$2 \\*[misc*st-\\$1]
  329. .el .ds misc*st-\\$1 \\$2
  330. ..
  331. .\"-------------
  332. .\" .misc@pop stackname
  333. .\" value returned in the string misc*pop
  334. .de misc@pop
  335. .misc@pop-set misc*st-\\$1 \\*[misc*st-\\$1]
  336. ..
  337. .\"-------------
  338. .de misc@pop-set
  339. .ds misc*st-name \\$1
  340. .shift
  341. .if \\n[.$]<1 .@error "stack \\*[misc*st-name] empty"
  342. .ds misc*pop \\$1
  343. .shift
  344. .ds \\*[misc*st-name] \\$*
  345. ..
  346. .\"-------------
  347. .\" .misc@pop-nr stackname varname
  348. .de misc@pop-nr
  349. .misc@pop \\$1
  350. .nr \\$2 \\*[misc*pop]
  351. ..
  352. .\"-------------
  353. .\" .misc@pop-ds stackname varname
  354. .de misc@pop-ds
  355. .misc@pop \\$1
  356. .ds \\$2 \\*[misc*pop]
  357. ..
  358. .\"-----------
  359. .\" reset tabs
  360. .de TAB
  361. .ta T 5n
  362. ..
  363. .\"-------------
  364. .\" .PGFORM linelength [ pagelength [ pageoffset ] ]
  365. .de PGFORM
  366. .if !''\\$1' .nr @ll \\$1
  367. .if !''\\$2' .nr @pl \\$2
  368. .if !''\\$3' .nr @po \\$3
  369. .ll \\n[@ll]u
  370. .lt \\n[@ll]u
  371. .po \\n[@po]u
  372. .pl \\n[@pl]u
  373. .nr @cur-ll \\n[@ll]
  374. .in 0
  375. .pg@move-trap
  376. ..
  377. .\"-------------
  378. .\" .MOVE y [[x] linelength]
  379. .\" move to line y, indent to x
  380. .de MOVE
  381. .if !\\n[.$] .@error "MOVE y [x]: no arguments"
  382. .if \\n[nl]<0 \c
  383. .sp |(v;\\$1)
  384. .ie \\n[.$]>2 .nr pg*i (v;\\$3)
  385. .el \{\
  386. .    ie \\n[.$]>1 .nr pg*i (v;\\n[@ll]u-\\$2)
  387. .    el .nr pg*i (v;\\n[@ll]u)
  388. .\}
  389. .if !''\\$2' \{\
  390. .    po \\$2
  391. .    ll \\n[pg*i]u+\\n[@po]u
  392. .\}
  393. ..
  394. .\"-------------
  395. .de SM
  396. .if !\\n[.$] .@error "SM: no arguments"
  397. .if \\n[.$]=1 \s-1\\$1\s0
  398. .if \\n[.$]=2 \s-1\\$1\s0\\$2
  399. .if \\n[.$]=3 \\$1\s-1\\$2\s0\\$3
  400. ..
  401. .\"-------------
  402. .nr misc*S-ps \n[@ps]
  403. .nr misc*S-vs \n[@vs]
  404. .nr misc*S-ps1 \n[@ps]
  405. .nr misc*S-vs1 \n[@vs]
  406. .ds misc*a
  407. .ds misc*b
  408. .de S
  409. .ie !\\n[.$] \{\
  410. .    ds misc*a P
  411. .    ds misc*b P
  412. .\}
  413. .el \{\
  414. .    ie \\n[.$]=1 .ds misc*b D
  415. .    el \{\
  416. .        ie \w'\\$2'=0 .ds misc*b C
  417. .        el .ds misc*b \\$2
  418. .    \}
  419. .    ie \w'\\$1'=0 .ds misc*a C
  420. .    el .ds misc*a \\$1
  421. .\}
  422. .\" set point size
  423. .if !'\\*[misc*a]'C' \{\
  424. .    ie '\\*[misc*a]'P' .nr @ps \\n[misc*S-ps]
  425. .    el \{\
  426. .        ie '\\*[misc*a]'D' .nr @ps 10
  427. .        el .nr @ps \\*[misc*a]
  428. .    \}
  429. .\}
  430. .\" set vertical spacing
  431. .if !'\\*[misc*b]'C' \{\
  432. .    ie '\\*[misc*b]'P' .nr @vs \\n[misc*S-vs]
  433. .    el \{\
  434. .        ie '\\*[misc*b]'D' .nr @vs \\n[@ps]+2
  435. .        el .nr @vs \\*[misc*b]
  436. .    \}
  437. .\}
  438. 'ps \\n[@ps]
  439. 'vs \\n[@vs]
  440. .if \\n[D]>1 .tm point-size \\n[@ps] (\\n[.s]), vertical spacing \\n[@vs] (\\n[.v])
  441. .nr misc*S-ps \\n[misc*S-ps1]
  442. .nr misc*S-vs \\n[misc*S-vs1]
  443. .nr misc*S-ps1 \\n[@ps]
  444. .nr misc*S-vs1 \\n[@vs]
  445. ..
  446. .\"------------
  447. .de HC
  448. .ev 0
  449. .hc \\$1
  450. .ev
  451. .ev 1
  452. .hc \\$1
  453. .ev
  454. .ev 2
  455. .hc \\$1
  456. .ev
  457. ..
  458. .\"------------
  459. .de RD
  460. .di misc*rd
  461. 'fl
  462. .rd \\$1
  463. .br
  464. .di
  465. .ie !''\\$3' \{\
  466. .    di misc*rd2
  467. .    ds \\$3 "\\*[misc*rd]
  468. .    br
  469. .    di
  470. .\}
  471. .if !''\\$2' .rn misc*rd \\$2
  472. .rm misc*rd misc*rd2
  473. ..
  474. .\"------------
  475. .de VERBON
  476. .br
  477. .misc@ev-keep misc*verb-ev
  478. .nf
  479. .ft CR
  480. .ss 12
  481. .ta T 8u*\w'n'u
  482. ..
  483. .de VERBOFF
  484. .ev
  485. ..
  486. .\" ######## module acc #################
  487. .\"-----------
  488. .\" accents. These are copied from mgs, written by James Clark.
  489. .de acc@over-def
  490. .ds \\$1 \Z'\v'(u;\w'x'*0+\En[rst]-\En[.cht])'\
  491. \h'(u;-\En[skw]+(-\En[.w]-\w'\\$2'/2)+\En[.csk])'\\$2'
  492. ..
  493. .de acc@under-def
  494. .ds \\$1 \Z'\v'\En[.cdp]u'\h'(u;-\En[.w]-\w'\\$2'/2)'\\$2'
  495. ..
  496. .acc@over-def ` \`
  497. .acc@over-def ' \'
  498. .acc@over-def ^ ^
  499. .acc@over-def ~ ~
  500. .acc@over-def : \(ad
  501. .acc@over-def ; \(ad
  502. .acc@under-def , \(ac
  503. .\" ######## module uni #################
  504. .\" unimplemented macros
  505. .de OK
  506. .tm "OK: not implemented"
  507. ..
  508. .de PM
  509. .tm "PM: not implemented"
  510. ..
  511. .\" ######## module hd #################
  512. .\" support for usermacro
  513. .nr hd*htype 0
  514. .ds hd*mark
  515. .ds hd*suf-space
  516. .nr hd*need 0
  517. .aln ;0 hd*htype
  518. .als }0 hd*mark
  519. .als }2 hd*suf-space
  520. .aln ;3 hd*need
  521. .\"-------------
  522. .\" .hd@split varable index name val1 val2 ...
  523. .de hd@split
  524. .if \\$2>(\\n[.$]-3) .@error "\\$3 must have at least \\$2 values (\\*[\\$3]).
  525. .nr hd*sp-tmp \\$2+3
  526. .ds \\$1 \\$[\\n[hd*sp-tmp]]
  527. ..
  528. .de HU
  529. .H 0 "\\$1"
  530. ..
  531. .\"-------------
  532. .de H
  533. .nr hd*cur-bline \\n[nl]
  534. .br
  535. .ds@print-float 2\"    $$$ could be wrong...
  536. .\" terminate all lists
  537. .LC 0
  538. .init@reset
  539. .nr hd*level 0\\$1
  540. .nr hd*arg1 0\\$1
  541. .if !\\n[hd*level] .nr hd*level \\n[Hu]
  542. .\"    Check if it's time for new page. Only if text has
  543. .\"    appeared before.
  544. .if \\n[Ej]&(\\n[Ej]>=\\n[hd*level])&(\\n[hd*cur-bline]>=0) .pg@next-page
  545. .\"    clear lower counters
  546. .nr hd*i 1 1
  547. .while \\n+[hd*i]<8 .if \\n[hd*level]<\\n[hd*i] .nr H\\n[hd*i] 0 1
  548. .\"
  549. .\" increment current counter
  550. .nr H\\n[hd*level] +1
  551. .ie \\n[hd*level]<=\\n[Hps] .SP \\n[Hps2]u\"         pre-space
  552. .el .SP \\n[Hps1]u
  553. .\"
  554. .\" hd*mark is the text written to the left of the header.
  555. .ds hd*mark \\n[H1].
  556. .if \\n[hd*level]>1 .as hd*mark \\n[H2]
  557. .nr hd*i 2 1
  558. .while \\n+[hd*i]<8 .if \\n[hd*level]>(\\n[hd*i]-1) .as hd*mark .\\n[H\\n[hd*i]]
  559. .if \\n[Ht] .ds hd*mark \\n[H\\n[hd*level]].
  560. .\"
  561. .\" toc-mark is sent to the table of contents
  562. .ds hd*toc-mark \\*[hd*mark]
  563. .as hd*mark \ \ \"            add spaces between mark and heading
  564. .if !\\n[hd*arg1] \{\
  565. .    ds hd*mark\"        no mark for unnumbered
  566. .    ds hd*toc-mark
  567. .\}
  568. .\"
  569. .if \\n[D]>1 .tm At header \\*[hd*toc-mark] "\\$2"
  570. .nr hd*htype 0                \" hd*htype = check break and space
  571. .                    \" 0 = run-in, 1 = break only, 2 = space
  572. .if \\n[hd*level]<=\\n[Hb] .nr hd*htype 1
  573. .if \\n[hd*level]<=\\n[Hs] .nr hd*htype 2
  574. .                    \" two spaces if hd*htype == 0
  575. .ie (\\n[hd*htype]=0)&(\w@\\$2@) .ds hd*suf-space "  \"
  576. .el .ds hd*suf-space
  577. .nr hd*need 2v                \" hd*need = header need space
  578. .\"---------- user macro HX ------------
  579. .\" user exit macro to override numbering
  580. .if d HX .HX \\n[hd*level] \\n[hd*arg1] "\\$2\\$3"
  581. .par@reset-num \\n[hd*level]\"            reset numbered paragraph
  582. .di hd*div
  583. \\*[hd*mark]\\$2\\$3\\*[hd*suf-space]
  584. .br
  585. .di
  586. .rm hd*div
  587. .if \\n[hd*htype]<2 .nr hd*need +.5v \"    add some extra space
  588. .ne \\n[hd*need]u+\\n[dn]u+.5p  \"    this is the needed space for a header
  589. .\"---------- user macro HY ------------- 
  590. .\"    user macro to reset indents
  591. .if d HY .HY \\n[hd*level] \\n[hd*arg1] "\\$2\\$3"
  592. .if \\n[hd*htype] .na \"        no adjust if run-in
  593. .hd@split hd*font \\n[hd*level] HF \\*[HF]\"    get font for this level
  594. .ft \\*[hd*font]\"            set new font
  595. .nr hd*ps-save \\n[.ps]u
  596. .hd@split hd*new-ps \\n[hd*level] HP \\*[HP]\"    get point size
  597. .ie (\\*[hd*new-ps]=0):(\w@\\*[hd*new-ps]@=0) \{\
  598. .    if \\n[hd*htype] \{\
  599. .        if '\\*[hd*font]'3' .ps -1z
  600. .        if '\\*[hd*font]'B' .ps -1z
  601. .    \}
  602. .\}
  603. .el .ps \\*[hd*new-ps]z
  604. .nr hd*mark-size \w'\\*[hd*mark]'
  605. .if (\\n[hd*level]<=\\n[Hc])&\\n[hd*htype] .ce\" center if level<=Hc
  606. .\"
  607. .\"    finally, output the header
  608. \\*[hd*mark]\&\c
  609. .\"    and the rest of the header
  610. .ie \\n[hd*htype] \{\
  611. \\$2\\$3
  612. .    br
  613. .\}
  614. .el \\$2\\$3\\*[hd*suf-space]\&\c
  615. .ft 1
  616. .ps \\n[hd*ps-save]u
  617. .\"
  618. .\" table of contents
  619. .if (\\n[hd*level]<=\\n[Cl])&\w@\\$2@ \{\
  620. .    toc@save \\n[hd*level] "\\*[hd*toc-mark]" "\\$2" \\n[%]
  621. .\}
  622. .\"    set adjust to previous value
  623. .SA
  624. .\"    do break or space
  625. .if \\n[hd*htype] .br
  626. .if \\n[hd*htype]>1 .SP .5
  627. .if \\n[hd*htype] \{\
  628. .    \"    indent if Hi=1 and Pt=1
  629. .    if (\\n[Hi]=1)&(\\n[Pt]=1) .ti +\\n[Pi]n
  630. .    \"    indent size of mark if Hi=2
  631. .    if \\n[hd*htype]&(\\n[Hi]>1) .ti +\\n[hd*mark-size]u
  632. .\}
  633. .nr par@ind-flag 0            \" no indent on .P if Pt=2
  634. .\"
  635. .\"    check if it is time to reset footnotes
  636. .if (\\n[hd*level]=1)&\\n[ft*clear-at-header] .nr ft*nr 0 1
  637. .\"
  638. .\"    check if it is time to reset indexes
  639. .if (\\n[hd*level]=1)&(\\n[N]=5) \{\
  640. .    nr lix*fg-nr 0 1
  641. .    nr lix*tb-nr 0 1
  642. .    nr lix*ec-nr 0 1
  643. .    nr lix*ex-nr 0 1
  644. .\}
  645. .\"---------- user macro HZ ----------
  646. .if d HZ .HZ \\n[hd*level] \\n[hd*arg1] "\\$2\\$3"
  647. .nr hd*last-pos \\n[nl]
  648. .nr hd*last-hpos \\n[.k]
  649. .nr par@ind-flag 0
  650. ..
  651. .\"--------
  652. .de HM
  653. .nr hd*i 0 1
  654. .while \\n+[hd*i]<8 .af H\\n[hd*i] \\$[\\n[hd*i]] 1
  655. ..
  656. .\"########### module pg ####################
  657. .\" set end of text trap
  658. .wh 0 pg@header
  659. .em pg@end-of-text
  660. .\"
  661. .ds pg*header ''- % -''
  662. .ds pg*even-footer
  663. .ds pg*odd-footer
  664. .ds pg*even-header
  665. .ds pg*odd-header
  666. .ds pg*footer
  667. .\"
  668. .nr pg*top-margin 0
  669. .nr pg*foot-margin 0
  670. .nr pg*block-size 0
  671. .nr pg*footer-size 5\"             1v+footer+even/odd footer+2v
  672. .nr pg*header-size 7\"             3v+header+even/odd header+2v
  673. .nr pg*extra-footer-size 0
  674. .nr pg*extra-header-size 0
  675. .nr ft*note-size 0
  676. .nr pg*cur-column 0
  677. .nr pg*cols-per-page 1
  678. .nr pg*cur-po \n[@po]
  679. .nr pg*head-mark 0
  680. .\"
  681. .nr pg*ps \n[@ps]
  682. .nr pg*vs \n[@vs]
  683. .\" compatibility reasons. Why not use %??
  684. .aln P %
  685. .\"-------------------------
  686. .\" footer traps: set, enable and disable
  687. .de pg@set-new-trap
  688. .nr pg*foot-trap \\n[@pl]u-(\\n[pg*block-size]u+\\n[ft*note-size]u+\\n[pg*foot-margin]u+\\n[pg*footer-size]v+\\n[pg*extra-footer-size]u)
  689. .if \\n[D]>2 .tm pg*foot-trap \\n[@pl]u-(\\n[pg*block-size]u+\\n[ft*note-size]u+\\n[pg*foot-margin]u+\\n[pg*footer-size]v) = \\n[pg*foot-trap]
  690. .\" last-pos points to the position of the footer and bottom 
  691. .\" block below foot-notes.
  692. .nr pg*last-pos \\n[@pl]u-(\\n[pg*block-size]u+\\n[pg*foot-margin]u+\\n[pg*footer-size]v)
  693. ..
  694. .de pg@enable-trap
  695. .wh \\n[pg*foot-trap]u pg@footer
  696. .if \\n[D]>2 .tm pg@enable-trap .t=\\n[.t] nl=\\n[nl]
  697. ..
  698. .de pg@disable-trap
  699. .ch pg@footer
  700. ..
  701. .\" move to new trap (if changed).
  702. .de pg@move-trap
  703. .pg@disable-trap
  704. .pg@set-new-trap
  705. .pg@enable-trap
  706. ..
  707. .de pg@enable-top-trap
  708. .\" set trap for pageheader.
  709. .nr pg*top-enabled 1
  710. ..
  711. .de pg@disable-top-trap
  712. .\" remove trap for pageheader.
  713. .nr pg*top-enabled 0
  714. ..
  715. .\" no header on the next page
  716. .de PGNH
  717. .nr pg*top-enabled -1
  718. ..
  719. .\" set first trap for pagefooter
  720. .pg@enable-top-trap
  721. .pg@set-new-trap
  722. .pg@enable-trap
  723. .\"-------------------------
  724. .\" stop output and begin on next page. Fix footnotes and all that.
  725. .de pg@next-page
  726. .\".debug next-page
  727. .ne 999i        \" activate trap
  728. .\" .pg@footer
  729. ..
  730. .\"-------------------------
  731. .\" support for PX and TP
  732. .als }t pg*header
  733. .als }e pg*even-header
  734. .als }o pg*odd-header
  735. .\"------------------------------------------------------------
  736. .\" HEADER
  737. .de pg@header
  738. .if \\n[D]>1 .tm Page# \\n[%] (\\n[.F]:\\n[c.])
  739. .if \\n[Idxf] \{\
  740. .tl '<pagenr\ \\n[%]>'''
  741. .\}
  742. .if \\n[pg*top-enabled] \{\
  743. .    if \\n[pg*extra-header-size] 'sp \\n[pg*extra-header-size]u
  744. .    if \\n[pg*top-margin] 'sp \\n[pg*top-margin]u
  745. .    ev pg*tl-ev
  746. .    pg@set-env
  747. .    ie !d TP \{\
  748. '        sp 3
  749. .        lt \\n[@ll]u
  750. .        tl \\*[pg*header]
  751. .        ie o .tl \\*[pg*odd-header]
  752. .        el .tl \\*[pg*even-header]
  753. '        sp 2
  754. .    \}
  755. .    el .TP
  756. .    ev
  757. .    \" why no-space??
  758. .    if d PX \{\
  759. .        ns
  760. .        PX
  761. .        rs
  762. .    \}
  763. .    \" check for pending footnotes 
  764. .    ft@check-old
  765. .    \"
  766. .    \" back to normal text processing
  767. .    \" .pg@enable-trap
  768. .    \" mark for multicolumn
  769. .    nr pg*head-mark \\n[nl]u
  770. .    \" set multicolumn
  771. .    \" 
  772. .    pg@set-po
  773. .    \" print floating displays
  774. .    ds@print-float 4
  775. .    tbl@top-hook
  776. .    ns
  777. .\}
  778. .if \\n[pg*top-enabled]<0 .nr pg*top-enabled 1
  779. ..
  780. .\"---------------------------------------------------------
  781. .\" FOOTER
  782. .de pg@footer
  783. .pg@disable-trap
  784. .\".debug footer
  785. .tbl@bottom-hook
  786. .\" increment pageoffset for MC
  787. .\" move to the exact start of footer.
  788. 'sp |\\n[pg*foot-trap]u+1v
  789. .\"
  790. .if \\n[D]>3 .tm FOOTER after .sp
  791. .\" print footnotes
  792. .if d ft*div .ft@print
  793. .\"
  794. .pg@inc-po
  795. .if !\\n[pg*cur-column] .pg@print-footer
  796. .\" next column
  797. .pg@set-po
  798. .pg@enable-trap
  799. ..
  800. .\"-------------------------
  801. .de pg@print-footer
  802. .\" jump to the position just below the foot-notes.
  803. 'sp |\\n[pg*last-pos]u+1v
  804. .\" check if there are any bottom block
  805. .if d pg*block-div .pg@block
  806. .\"
  807. .\" print the footer and eject new page
  808. .ev pg*tl-ev
  809. .pg@set-env
  810. .lt \\n[@ll]u
  811. .ie o .tl \\*[pg*odd-footer]
  812. .el .tl \\*[pg*even-footer]
  813. .tl \\*[pg*footer]
  814. .ev
  815. .ie (\\n[ds*fnr]>=\\n[ds*o-fnr]):\\n[ft*exist] \{\
  816. .    ev ne
  817. '    bp
  818. .    ev
  819. .\}
  820. .el 'bp
  821. ..
  822. .\"-------------------------
  823. .\"
  824. .\" Initialize the title environment
  825. .de pg@set-env
  826. 'na
  827. 'nh
  828. 'in 0
  829. 'ti 0
  830. 'ps \\n[pg*ps]
  831. 'vs \\n[pg*vs]
  832. ..
  833. .\"-------------------------
  834. .de PH
  835. .ds pg*header "\\$1
  836. .pg@set-new-size
  837. ..
  838. .de PF
  839. .ds pg*footer "\\$1
  840. .pg@set-new-size
  841. ..
  842. .de OH
  843. .ds pg*odd-header "\\$1
  844. .pg@set-new-size
  845. ..
  846. .de EH
  847. .ds pg*even-header "\\$1
  848. .pg@set-new-size
  849. ..
  850. .de OF
  851. .ds pg*odd-footer "\\$1
  852. .pg@set-new-size
  853. ..
  854. .de EF
  855. .ds pg*even-footer "\\$1
  856. .pg@set-new-size
  857. ..
  858. .de pg@clear-hd
  859. .ds pg*even-header
  860. .ds pg*odd-header
  861. .ds pg*header
  862. ..
  863. .de pg@clear-ft
  864. .ds pg*even-footer
  865. .ds pg*odd-footer
  866. .ds pg*footer
  867. ..
  868. .de pg@set-new-size
  869. .nr pg*ps \\n[@ps]
  870. .nr pg*vs \\n[@vs]
  871. .pg@move-trap
  872. ..
  873. .\"-------------------------
  874. .\" end of page processing
  875. .de pg@footnotes
  876. .\".debug footnotes
  877. .\" output footnotes. set trap for block
  878. .\"
  879. ..
  880. .\"-------------------------
  881. .\" print bottom block
  882. .de pg@block
  883. .ev pg*block-ev
  884. 'nf
  885. 'in 0
  886. .ll 100i
  887. .pg*block-div
  888. .br
  889. .ev
  890. ..
  891. .\"-------------------------
  892. .\" define bottom block
  893. .de BS
  894. .misc@ev-keep pg*block-ev
  895. .init@reset
  896. .br
  897. .di pg*block-div
  898. ..
  899. .\"-------------------------
  900. .de BE
  901. .br
  902. .di
  903. .nr pg*block-size \\n[dn]u
  904. .ev
  905. .pg@move-trap
  906. ..
  907. .\"-------------------------
  908. .\" print out all pending text
  909. .de pg@end-of-text
  910. .\" non-empty environment
  911. .misc@ev-keep ne
  912. .init@reset
  913. \c
  914. .ds@print-float 3
  915. .ev
  916. .if d ref*div .RP
  917. ..
  918. .\"-------------------------
  919. .\" set top and bottom margins 
  920. .de VM
  921. .if \\n[.$]=0 \{\
  922. .    nr pg*extra-footer-size 0
  923. .    nr pg*extra-header-size 0
  924. .\}
  925. .if \\n[.$]>0 .nr pg*extra-header-size (v;\\$1)
  926. .if \\n[.$]>1 .nr pg*extra-footer-size (v;\\$2)
  927. .if \\n[D]>2 \{\
  928. .    tm extra top \\n[pg*extra-footer-size]
  929. .    tm extra bottom \\n[pg*extra-header-size]
  930. .\}
  931. .pg@move-trap
  932. ..
  933. .\"---------------------
  934. .\" multicolumn output. 
  935. .de pg@set-po
  936. .if \\n[pg*cols-per-page]>1 \{\
  937. .    ll \\n[pg*column-size]u
  938. .\}
  939. ..
  940. .de pg@inc-po
  941. .if \\n[pg*cols-per-page]>1 \{\
  942. .    ie \\n+[pg*cur-column]>=\\n[pg*cols-per-page] \{\
  943. .        nr pg*cur-column 0 1
  944. .        nr pg*cur-po \\n[@po]u
  945. .        po \\n[@po]u
  946. .        ll \\n[@ll]u
  947. .    \}
  948. .    el \{\
  949. .        nr pg*cur-po +(\\n[pg*column-size]u+\\n[pg*column-sep]u)
  950. .        po \\n[pg*cur-po]u
  951. '        sp |\\n[pg*head-mark]u
  952. .    \}
  953. .\}
  954. ..
  955. .de 1C
  956. .br
  957. .if \\n[pg*cols-per-page]<=1 .@error "1C: multicolumn mode not active"
  958. .nr pg*cols-per-page 1
  959. .nr pg*column-sep 0
  960. .nr pg*column-size \\n[@ll]
  961. .nr pg*cur-column 0 1
  962. .nr pg*cur-po \\n[@po]u
  963. .PGFORM
  964. .\".pg@next-page
  965. .SK
  966. ..
  967. .de 2C
  968. .br
  969. .nr pg*head-mark \\n[nl]u
  970. .if \\n[pg*cols-per-page]>1 .@error "2C: multicolumn mode already active"
  971. .nr pg*cols-per-page 2
  972. .nr pg*column-sep \\n[@ll]/15
  973. .nr pg*column-size (\\n[@ll]u*7)/15
  974. .nr pg*cur-column 0 1
  975. .nr pg*cur-po \\n[@po]u
  976. .ll \\n[pg*column-size]u
  977. .lt \\n[pg*column-size]u
  978. ..
  979. .\" MC column-size [ column-separation ]
  980. .de MC
  981. .br
  982. .nr pg*head-mark \\n[nl]u
  983. .if \\n[pg*cols-per-page]>1 .@error "MC: multicolumn mode already active"
  984. .ie ''\\$1' .nr pg*column-size \\n[.l]
  985. .el .nr pg*column-size (n;\\$1)
  986. .ie ''\\$2' .nr pg*column-sep \\n[pg*column-size]/15
  987. .el .nr pg*column-sep (n;\\$2)
  988. .\"
  989. .nr pg*cols-per-page (u;\\n[.l]/(\\n[pg*column-size]+\\n[pg*column-sep]+1))
  990. .nr pg*cur-column 0 1
  991. .nr pg*cur-po \\n[@po]u
  992. .ll \\n[pg*column-size]u
  993. .lt \\n[pg*column-size]u
  994. ..
  995. .\" begin a new column
  996. .de NCOL
  997. .br
  998. .pg@footer
  999. ..
  1000. .\" skip pages
  1001. .de SK
  1002. .br
  1003. .bp
  1004. .nr pg*i 0 1
  1005. .while \\n+[pg*i]<=(0\\$1) .bp
  1006. ..
  1007. .\"-----------
  1008. .de OP
  1009. .br
  1010. .ie o .if !\\n[pg*head-mark]=\\n[nl] .bp +2
  1011. .el .bp
  1012. ..
  1013. .\"########### module footnotes ###################
  1014. .nr ft*note-size 0
  1015. .nr ft*busy 0
  1016. .nr ft*nr 0 1
  1017. .nr ft*wide 0
  1018. .nr ft*hyphen 0\"    hyphenation value
  1019. .nr ft*adjust 1\"    >0 if adjust true
  1020. .nr ft*indent 1\"    >0 if text indent true (not imp. $$$)
  1021. .nr ft*just 0\"    0=left justification, 1=right (not imp. $$$)
  1022. .nr ft*exist 0\"    not zero if there are any footnotes to be printed
  1023. .nr ft*clear-at-header 0\" >0 if footnotes should be reset at first level head.
  1024. .\"
  1025. .ds F \v'-.4m'\s-3\\n+[ft*nr]\s0\v'.4m'
  1026. .\"
  1027. .\"-----------------
  1028. .\" init footnote environment
  1029. .de ft@init
  1030. .\" indentcontrol not implemented $$$
  1031. .\" label justification not implemented $$$
  1032. 'in 0
  1033. 'fi
  1034. .ie \\n[ft*adjust] 'ad
  1035. .el 'na
  1036. .ie \\n[ft*hyphen] 'hy 14
  1037. .el 'hy 0
  1038. .ll \\n[@cur-ll]u
  1039. .lt \\n[@cur-ll]u
  1040. .ps (\\n[@ps]-2)
  1041. .vs (\\n[@vs]-1)
  1042. ..
  1043. .\"-----------------
  1044. .\" set footnote format
  1045. .\" no support for two column processing (yet). $$$
  1046. .de FD
  1047. .if \\n[.$]=0 .@error "FD: bad arg \\$1"
  1048. .ie \\$1>11 .nr ft*format 0
  1049. .el .nr ft*format \\$1
  1050. .\"
  1051. .ie \\n[.$]=2 .nr ft*clear-at-header 1
  1052. .el .nr ft*clear-at-header 0
  1053. .\"
  1054. .nr ft*hyphen (\\n[ft*format]%2)*14
  1055. .nr ft*format \\n[ft*format]/2
  1056. .\"
  1057. .nr ft*adjust 1-(\\n[ft*format]%2)
  1058. .nr ft*format \\n[ft*format]/2
  1059. .\"
  1060. .nr ft*indent 1-(\\n[ft*format]%2)
  1061. .nr ft*format \\n[ft*format]/2
  1062. .\"
  1063. .nr ft*just \\n[ft*format]%2
  1064. ..
  1065. .\"---------------
  1066. .\" Footnote and display width control $$$
  1067. .de WC
  1068. .nr ft*i 0 1
  1069. .while \\n+[ft*i]<=\\n[.$] \{\
  1070. .    ds ft*x \\$[\\n[ft*i]]
  1071. .    if '\\*[ft*x]'N' \{\
  1072. .        nr ft*wide 0
  1073. .        nr ft*first-fn 0
  1074. .        nr ds*wide 0
  1075. .        nr ds*float-break 1
  1076. .    \}
  1077. .    if '\\*[ft*x]'-WF' .nr ft*wide 0
  1078. .    if '\\*[ft*x]'WF' .nr ft*wide 1
  1079. .    if '\\*[ft*x]'-FF' .nr ft*first-fn 0
  1080. .    if '\\*[ft*x]'FF' .nr ft*first-fn 1
  1081. .    if '\\*[ft*x]'-WD' .nr ds*wide 0
  1082. .    if '\\*[ft*x]'WD' .nr ds*wide 1
  1083. .    if '\\*[ft*x]'-FB' .nr ds*float-break 0
  1084. .    if '\\*[ft*x]'FB' .nr ds*float-break 1
  1085. .\}
  1086. ..
  1087. .\"-----------------
  1088. .\" begin footnote
  1089. .de FS
  1090. .if \\n[ft*busy] .@error "FS: missing FE"
  1091. .nr ft*busy 1
  1092. .ev ft*ev
  1093. .ft@init
  1094. .if !\\n[ft*wide] .pg@set-po
  1095. .if !d ft*div .ft@init-footnote
  1096. .di ft*tmp-div
  1097. .nr ft*space \\n[Fs]v/2u
  1098. .sp \\n[ft*space]u
  1099. .\" print mark
  1100. .ie \\n[.$] .ds ft*mark \\$1
  1101. .el .ds ft*mark \\n[ft*nr].
  1102. \\*[ft*mark]
  1103. .in +.75c
  1104. .sp -1
  1105. .nr ft*exist 1
  1106. ..
  1107. .\"-----------------
  1108. .\" init footnote diversion
  1109. .de ft@init-footnote
  1110. .di ft*div
  1111. \l'20n'
  1112. .br
  1113. .di
  1114. .nr ft*note-size \\n[dn]
  1115. ..
  1116. .\"-----------------
  1117. .\" end footnote
  1118. .de FE
  1119. .nr ft*busy 0
  1120. .br
  1121. .di
  1122. 'in 0
  1123. 'nf
  1124. .if \\n[@pl]u<\\n[dn]u .@error "FE: too big footnote"
  1125. .ie (\\n[pg*foot-trap]u-\\n[.d]u)<\\n[dn]u \{\
  1126. .    da ft*next-div
  1127. .    ft*tmp-div
  1128. .    br
  1129. .    di
  1130. .\}
  1131. .el \{\
  1132. .    da ft*div
  1133. .    ft*tmp-div
  1134. .    di
  1135. .    nr ft*note-size +\\n[dn]
  1136. .\}
  1137. .rm ft*tmp-div
  1138. .ev
  1139. .pg@move-trap
  1140. ..
  1141. .\"-----------------
  1142. .\" print footnotes, see pg@footer
  1143. .de ft@print
  1144. .ev ft*print-ev
  1145. 'nf
  1146. 'in 0
  1147. .ll 100i
  1148. .ft*div
  1149. .br
  1150. .ev
  1151. .rm ft*div
  1152. .nr ft*note-size 0
  1153. .pg@move-trap
  1154. ..
  1155. .\"-----------------
  1156. .\" check if any pending footnotes, see pg@header
  1157. .de ft@check-old
  1158. .if d ft*next-div \{\
  1159. .    ev ft*ev
  1160. .    ft@init
  1161. .    ft@init-footnote
  1162. .    nf
  1163. .    in 0
  1164. .    da ft*div
  1165. .    ft*next-div
  1166. .    di
  1167. .    nr ft*note-size +\\n[dn]
  1168. .    rm ft*next-div
  1169. .    ev
  1170. .    nr ft*exist 0
  1171. .    pg@move-trap
  1172. .\}
  1173. ..
  1174. .\"########### module display ###################
  1175. .nr ds*wide 0\"        >0 if wide displays wanted
  1176. .nr ds*fnr 0 1\"    floating display counter
  1177. .nr ds*o-fnr 1\"    floating display counter, already printed
  1178. .nr ds*snr 0 1\"    static display counter
  1179. .nr ds*lvl 0 1\"    display level
  1180. .nr ds*float-busy 0\"    >0 if printing float
  1181. .nr ds*ffloat 0\"    >0 if DF, 0 if DS
  1182. .\" static display start
  1183. .\" nested DS/DE is allowed. No limit on depth.
  1184. .de DS
  1185. .br
  1186. .ds@start 0 DS \\$@
  1187. ..
  1188. .\" floating display start
  1189. .\" nested DF/DE is not allowed.
  1190. .de DF
  1191. .if \\n[ds*lvl] .@error "DF:nested floating is not allowed. Use DS."
  1192. .ds@start 1 DF \\$@
  1193. ..
  1194. .\"---------------
  1195. .nr ds*format 0\"    dummy value for .En/.EQ
  1196. .nr ds*format! 0\"    no indent
  1197. .nr ds*format!0 0\"    no indent
  1198. .nr ds*format!L 0\"    no indent
  1199. .nr ds*format!I 1\"    indent
  1200. .nr ds*format!1 1\"    indent
  1201. .nr ds*format!C 2\"    center each line
  1202. .nr ds*format!2 2\"    center each line
  1203. .nr ds*format!CB 3\"    center as block
  1204. .nr ds*format!3 3\"    center as block
  1205. .nr ds*format!R 4\"    right justify each line
  1206. .nr ds*format!4 4\"    right justify each line
  1207. .nr ds*format!RB 5\"    right justify as block
  1208. .nr ds*format!5 5\"    right justify as block
  1209. .\"---------------
  1210. .nr ds*fill! 0\"    no fill
  1211. .nr ds*fill!N 0\"    no fill
  1212. .nr ds*fill!0 0\"    no fill
  1213. .nr ds*fill!F 1\"    fill on
  1214. .nr ds*fill!1 1\"    fill on
  1215. .\"---------------
  1216. .de ds@start
  1217. .nr ds*ffloat \\$1
  1218. .ds ds*type \\$2
  1219. .shift 2
  1220. .nr ds*lvl +1
  1221. .\" get format of the display
  1222. .ie \\n[.$] \{\
  1223. .    ie r ds*format!\\$1 .nr ds*format \\n[ds*format!\\$1]
  1224. .    el .@error "\\*[ds*type]:wrong format:\\$1"
  1225. .\}
  1226. .el .nr ds*format 0
  1227. .\" fill or not to fill, that is the...
  1228. .nr ds*fill 0
  1229. .ie \\n[.$]>1 \{\
  1230. .    ie r ds*fill!\\$2 .nr ds*fill \\n[ds*fill!\\$2]
  1231. .    el .@error "\\*[ds*type]:wrong fill:\\$2"
  1232. .\}
  1233. .nr ds*rindent 0
  1234. .if \\n[.$]>2 .nr ds*rindent \\$3
  1235. .\"
  1236. .\"
  1237. .nr ds*old-ll \\n[.l]
  1238. .misc@push ds-ll \\n[.l]
  1239. .misc@push ds-form \\n[ds*format]
  1240. .misc@push ds-ffloat \\n[ds*ffloat]
  1241. .nr ds*i \\n[.i]
  1242. .nr ds*ftmp \\n[.f]
  1243. .misc@ev-keep ds*ev!\\n+[ds*snr]
  1244. .ft \\n[ds*ftmp]
  1245. .\"
  1246. .init@reset
  1247. 'in \\n[ds*i]u
  1248. .di ds*div!\\n[ds*snr]
  1249. .\"
  1250. .ll \\n[ds*old-ll]u
  1251. .lt \\n[ds*old-ll]u
  1252. .if \\n[ds*rindent] \{\
  1253. .    ll -\\n[ds*rindent]n
  1254. .    lt -\\n[ds*rindent]n
  1255. .\}
  1256. .if \\n[ds*wide] \{\
  1257. .    ll \\n[@ll]u
  1258. .    lt \\n[@ll]u
  1259. .\}
  1260. .\"
  1261. .ie \\n[ds*fill] 'fi
  1262. .el 'nf
  1263. .\"
  1264. .if \\n[ds*format]=1 \{\
  1265. .    ll -\\n[Si]n
  1266. .    lt -\\n[Si]n
  1267. '    in +\\n[Si]n
  1268. .\}
  1269. .if (\\n[ds*format]=3):(\\n[ds*format]=5) 'in 0
  1270. ..
  1271. .\"---------------
  1272. .de DE
  1273. .if \\n-[ds*lvl]<0 .@error "DE: no corresponding DS or DF"
  1274. .br
  1275. .if \\n[ds*ffloat] .SP \\n[Lsp]u
  1276. .di
  1277. .nr ds*width \\n[dl]
  1278. .nr ds*height \\n[dn]
  1279. .misc@pop-nr ds-ll ds*old-ll
  1280. .misc@pop-nr ds-form ds*format
  1281. .misc@pop-nr ds-ffloat ds*ffloat
  1282. .if (\\n[ds*format]>=2)&(\\n[ds*width]>\\n[ds*old-ll]) \{\
  1283. .    @error "DE: display too wide for current line-length"
  1284. .\}
  1285. .\" prepare copy to floating display
  1286. .if \\n[ds*ffloat] .di ds*fdiv!\\n+[ds*fnr]
  1287. .\"
  1288. 'in 0
  1289. 'nf
  1290. .if \\n[ds*format]=2 'ce 9999
  1291. .if \\n[ds*format]=3 'in (u;(\\n[ds*old-ll]-\\n[ds*width])/2)
  1292. .if \\n[ds*format]=4 'rj 9999
  1293. .if \\n[ds*format]=5 'in (u;\\n[ds*old-ll]-\\n[ds*width])
  1294. .\"
  1295. .ie !\\n[ds*ffloat] \{\
  1296. .    \"
  1297. .    \"    Print static display
  1298. .    \"    Eject page if display will fit one page and
  1299. .    \"    there are less than half of the page left.
  1300. .    nr ds*i \\n[pg*foot-trap]-\\n[pg*header-size]v-\\n[pg*extra-header-size]v
  1301. .    if (\\n[ds*height]>\\n[ds*i])&(\\n[.t]<(\\n[ds*i]/2)) \{\
  1302. .        ne \\n[.t]u+1v
  1303. .    \}
  1304. .    if (\\n[ds*height]<\\n[ds*i])&(\\n[.t]<(\\n[ds*height])) \{\
  1305. .        ne \\n[.t]u+1v
  1306. .    \}
  1307. .    if \\n[Ds] .SP \\n[Lsp]u
  1308. .\}
  1309. .el .SP \\n[Lsp]u
  1310. .ds*div!\\n[ds*snr]
  1311. .ie !\\n[ds*ffloat] .if \\n[Ds] .SP \\n[Lsp]u
  1312. .el \{\
  1313. .    SP \\n[Lsp]u
  1314. .    di
  1315. .\}
  1316. .if \\n[ds*format]=2 'ce 0
  1317. .if \\n[ds*format]=4 'rj 0
  1318. .rm ds*div!\\n[ds*snr]
  1319. .nr ds*snr -1
  1320. .nr par@ind-flag 0
  1321. .\"        move div to the floating display list
  1322. .ev
  1323. .if \\n[ds*ffloat] \{\
  1324. .    nr ds*fsize!\\n[ds*fnr] \\n[dn]
  1325. .    \" print float if queue is empty and the display fits into
  1326. .    \" the current page
  1327. .    if (\\n[ds*fnr]>\\n[ds*o-fnr])&(\\n[ds*height]<\\n[.t]) \{\
  1328. .        ds@print-float 1
  1329. .    \}
  1330. .\}
  1331. ..
  1332. .\"---------------
  1333. .\" print according to Df and De.
  1334. .\" .ds@print-float type
  1335. .\"    type    called from
  1336. .\"    1    .DE
  1337. .\"    2    end of section
  1338. .\"    3    end of document
  1339. .\"    4    beginning of new page
  1340. .\"
  1341. .de ds@print-float
  1342. .if \\n[Df]>5 .@error "Df=\\n[Df], max value is 5"
  1343. .if !\\n[ds*float-busy] \{\
  1344. .    nr ds*float-busy 1
  1345. .\" at .DE
  1346. .    if (\\$1=1)&((\\n[Df]%2)=1) \{\
  1347. .        if \\n[.t]>\\n[ds*fsize!\\n[ds*fnr]] \{\
  1348. .            \" Df = 1,3 or 5
  1349. .            ds@print-one-float
  1350. .        \}
  1351. .    \}
  1352. .\" print all if Df<2 and end of section
  1353. .    if (\\$1=2)&(\\n[Df]<2) .ds@print-all-floats
  1354. .\" print all if end of document. Where should they go instead?
  1355. .    if \\$1=3 .ds@print-all-floats
  1356. .\" new page
  1357. .    if (\\$1=4)&(\\n[Df]>1) \{\
  1358. .        if \\n[Df]=2 .ds@print-one-float
  1359. .        if \\n[Df]=3 .ds@print-one-float
  1360. .        if \\n[Df]>3 \{\
  1361. .            ie \\n[De] .ds@print-all-floats
  1362. .            el .ds@print-this-page
  1363. .        \}
  1364. .    \}
  1365. .    nr ds*float-busy 0
  1366. .\}
  1367. ..
  1368. .\"---------------
  1369. .\" print a floating diversion
  1370. .de ds@output-div
  1371. .ev ds*fev
  1372. .in 0
  1373. .nf
  1374. .ds*fdiv!\\n[ds*o-fnr]
  1375. .ev
  1376. .rm ds*fdiv!\\n[ds*o-fnr]
  1377. .rm ds*fsize!\\n[ds*o-fnr]
  1378. .rm ds*fformat!\\n[ds*o-fnr]
  1379. .nr ds*o-fnr +1
  1380. ..
  1381. .\"---------------
  1382. .\" print one floating display if there is one.
  1383. .de ds@print-one-float
  1384. .if \\n[ds*o-fnr]<=\\n[ds*fnr] \{\
  1385. .    if \\n[.t]<\\n[ds*fsize!\\n[ds*o-fnr]] .pg@next-page
  1386. .    ds@output-div
  1387. .    if \\n[De] .pg@next-page
  1388. .\}
  1389. ..
  1390. .\"---------------
  1391. .\" print all queued floats.
  1392. .\" if De>0 do a page eject between the floats.
  1393. .de ds@print-all-floats
  1394. .while \\n[ds*o-fnr]<=\\n[ds*fnr] \{\
  1395. .    if \\n[.t]<\\n[ds*fsize!\\n[ds*o-fnr]] .pg@next-page
  1396. .    ds@output-div
  1397. .    if \\n[De] .pg@next-page
  1398. .\}
  1399. ..
  1400. .\"---------------
  1401. .\" print as many floats as will fit on the current page
  1402. .de ds@print-this-page
  1403. .while \\n[ds*o-fnr]<=\\n[ds*fnr] \{\
  1404. .    if \\n[.t]<\\n[ds*fsize!\\n[ds*o-fnr]] .break
  1405. .    ds@output-div
  1406. .\}
  1407. ..
  1408. .\"########### module list ###################
  1409. .\" .LI text-indent mark-indent pad type [mark [LI-space [LB-space] ] ]
  1410. .\"
  1411. .nr li*tind 0
  1412. .nr li*mind 0
  1413. .nr li*pad 0
  1414. .nr li*type 0
  1415. .ds li*mark 0
  1416. .nr li*li-spc 0
  1417. .nr li*lvl 0 1
  1418. .nr li*cur-vpos 0
  1419. .\"--------------------------
  1420. .\"    the major list-begin macro.
  1421. .\"    If type == -1 a 'break' will occur.
  1422. .de LB
  1423. .if \\n[.$]<4 .@error "LB: not enough arguments, min 4"
  1424. .misc@push cind \\n[.i]
  1425. .misc@push tind \\n[li*tind]
  1426. .misc@push mind \\n[li*mind]
  1427. .misc@push pad \\n[li*pad]
  1428. .misc@push type \\n[li*type]
  1429. .misc@push li-spc \\n[li*li-spc]
  1430. .ds li*mark-list!\\n[li*lvl] \\*[li*mark]
  1431. .nr li*lvl +1
  1432. .\"
  1433. .nr li*tind (n;0\\$1)\"            text-indent
  1434. .nr li*mind (n;0\\$2)\"            mark-indent
  1435. .nr li*pad (n;0\\$3)\"            pad
  1436. .nr li*type 0\\$4\"            type
  1437. .ds li*mark \\$5\"            mark
  1438. .ie !'\\$6'' .nr li*li-spc \\$6\"    LI-space
  1439. .el .nr li*li-spc 1
  1440. .ie !'\\$7'' .nr li*lb-spc \\$6\"    LB-space
  1441. .el .nr li*lb-spc 0
  1442. .\" init listcounter
  1443. .nr li*cnt!\\n[li*lvl] 0 1
  1444. .\" assign format
  1445. .af li*cnt!\\n[li*lvl] 1
  1446. .if \\n[li*type] .if !'\\*[li*mark]'' .af li*cnt!\\n[li*lvl] \\*[li*mark]
  1447. .\"
  1448. .if \\n[li*lb-spc] .SP \\n[li*lb-spc]v/2u
  1449. .in +\\n[li*tind]u
  1450. ..
  1451. .\"---------------
  1452. .de LI
  1453. .if \\n[li*lvl]<1 .@error "LI:no lists active"
  1454. .if \\n[li*li-spc]&(\\n[Ls]>=\\n[li*lvl]) .SP \\n[li*li-spc]v/2u
  1455. .ne 2v
  1456. .\"
  1457. .ds li*c-mark \\*[li*mark]
  1458. .nr li*cnt!\\n[li*lvl] +1
  1459. .if \\n[li*type]=1 .ds li*c-mark \\n[li*cnt!\\n[li*lvl]].
  1460. .if \\n[li*type]=2 .ds li*c-mark \\n[li*cnt!\\n[li*lvl]])
  1461. .if \\n[li*type]=3 .ds li*c-mark (\\n[li*cnt!\\n[li*lvl]])
  1462. .if \\n[li*type]=4 .ds li*c-mark [\\n[li*cnt!\\n[li*lvl]]]
  1463. .if \\n[li*type]=5 .ds li*c-mark <\\n[li*cnt!\\n[li*lvl]]>
  1464. .if \\n[li*type]=6 .ds li*c-mark {\\n[li*cnt!\\n[li*lvl]]}
  1465. .if \\n[.$]=1 .ds li*c-mark \\$1
  1466. .if \\n[.$]=2 .ds li*c-mark \\$1\ \\*[li*c-mark]
  1467. .if '\\*[li*c-mark]'\ ' .ds li*c-mark
  1468. .\"
  1469. .\" determine where the text begins
  1470. .nr li*text-begin \\n[li*tind]>?\w'\\*[li*c-mark]\ '
  1471. .\"
  1472. .\" determine where the mark begin
  1473. .ie !\\n[li*pad] .nr li*in \\n[li*mind]
  1474. .el .nr li*in \\n[li*text-begin]-\\n[li*pad]-\w'\\*[li*c-mark]'
  1475. .if !\\n[li*in] .nr li*in 0
  1476. .\"
  1477. .ti -\\n[li*tind]u
  1478. .\" no indentation if hanging indent
  1479. .if (\w'\\*[li*c-mark]'=0)&((\\n[.$]=0):(\w'\\$1'=0)) .nr li*text-begin 0
  1480. \Z'\&\h'\\n[li*in]u'\\*[li*c-mark]'\h'\\n[li*text-begin]u'\&\c
  1481. .if \\n[li*type]=-1 .br
  1482. ..
  1483. .\"
  1484. .\"-------------
  1485. .de li@pop
  1486. .nr li*lvl -1
  1487. .misc@pop-nr cind li*tmp
  1488. .in \\n[li*tmp]u
  1489. .misc@pop-nr tind li*tind
  1490. .misc@pop-nr mind li*mind
  1491. .misc@pop-nr pad li*pad
  1492. .misc@pop-nr type li*type
  1493. .misc@pop-nr li-spc li*li-spc
  1494. .ds li*mark \\*[li*mark-list!\\n[li*lvl]]
  1495. ..
  1496. .de LE
  1497. .if \\n[li*lvl]<1 .@error "LE:mismatched"
  1498. .li@pop
  1499. .if '\\$1'1' .SP .5
  1500. ..
  1501. .\"-------------
  1502. .\"    list status clear.
  1503. .de LC
  1504. .if !\\n[.$]=1 .@error "LC: no argument"
  1505. .if \\$1>\\n[li*lvl] .@error "LC: incorrect argument: \\$1 (too big)"
  1506. .while \\n[li*lvl]>\\$1 .li@pop
  1507. .nr par@ind-flag 0
  1508. ..
  1509. .\"-------------
  1510. .de AL
  1511. .if \\n[.$]>3 .@error "AL: too many arguments"
  1512. .if \\n[D]>2 .tm AL $*
  1513. .ie \\n[.$]<=1 .LB \\n[Li] 0 2 1 "\\$1"
  1514. .el \{\
  1515. .    ie \\n[.$]=2 .LB 0\\$2 0 2 1 "\\$1"
  1516. .    el \{\
  1517. .        ie !'\\$2'' .LB \\$2 0 2 1 "\\$1" 0 1
  1518. .        el .LB \\n[Li] 0 2 1 "\\$1" 0 1
  1519. .    \}
  1520. .\}
  1521. ..
  1522. .de ML
  1523. .if \\n[.$]>3 .@error "ML: too many arguments"
  1524. .if \\n[D]>2 .tm ML $*
  1525. .nr li*ml-width \w'\\$1'u+1n
  1526. .if \\n[.$]<2 .LB \\n[li*ml-width]u 0 1 0 "\\$1"
  1527. .if \\n[.$]=2 .LB 0\\$2 0 1 0 "\\$1"
  1528. .if \\n[.$]=3 \{\
  1529. .    ie '\\$2'' .LB \\n[li*ml-width]u 0 1 0 "\\$1" 0 1
  1530. .    el .LB \\n[Li] 0 1 0 "\\$1" 0 1
  1531. .\}
  1532. ..
  1533. .de VL
  1534. .if \\n[D]>2 .tm VL $*
  1535. .if \\n[.$]>3 .@error "VL: too many arguments"
  1536. .if \\n[.$]<1 .@error "VL: missing text-indent"
  1537. .ie \\n[.$]<3 .LB 0\\$1 0\\$2 0 0
  1538. .el .LB 0\\$1 0\\$2 0 0 \& 0 1
  1539. ..
  1540. .\"    Bullet (for .BL)
  1541. .de BL
  1542. .if \\n[D]>2 .tm BL $*
  1543. .ds BU \s-2\(bu\s0
  1544. .if \\n[.$]>2 .@error "BL: too many arguments"
  1545. .if \\n[.$]<1 .LB \\n[Pi] 0 1 0 \\*[BU]
  1546. .if \\n[.$]=1 .LB 0\\$1 0 1 0 \\*[BU]
  1547. .if \\n[.$]=2 \{\
  1548. .    ie '\\$1'' .LB \\n[Pi] 0 1 0 \\*[BU] 0 1
  1549. .    el .LB 0\\$1 0 1 0 \\*[BU] 0 1
  1550. .\}
  1551. ..
  1552. .de DL
  1553. .if \\n[D]>2 .tm DL $*
  1554. .if \\n[.$]>2 .@error "DL: too many arguments"
  1555. .if \\n[.$]<=1 .LB \\n[Pi] 0 1 0 \(em
  1556. .if \\n[.$]=1 .LB 0\\$1 0 1 0 \(em
  1557. .if \\n[.$]=2 \{\
  1558. .    ie '\\$1'' .LB \\n[Pi] 0 1 0 \(em 0 1
  1559. .    el .LB 0\\$1 0 1 0 \(em 0 1
  1560. .\}
  1561. ..
  1562. .de RL
  1563. .if \\n[D]>2 .tm RL $*
  1564. .if \\n[.$]>2 .@error "RL: too many arguments"
  1565. .if \\n[.$]<1 .LB 6 0 2 4
  1566. .if \\n[.$]=1 .LB 0\\$1 0 2 4
  1567. .if \\n[.$]=2 \{\
  1568. .    ie '\\$1'' .LB 6 0 2 4 1 0 1
  1569. .    el .LB 0\\$1 0 2 4 1 0 1
  1570. .\}
  1571. ..
  1572. .\" Broken Variable List. As .VL but text begin on the next line
  1573. .de BVL
  1574. .if \\n[D]>2 .tm BVL $*
  1575. .if \\n[.$]>3 .@error "BVL: too many arguments"
  1576. .if \\n[.$]<1 .@error "BVL: missing text-indent"
  1577. .ie \\n[.$]<3 .LB 0\\$1 0\\$2 0 -1
  1578. .el .LB 0\\$1 0\\$2 0 -1 \& 0 1
  1579. ..
  1580. .\" ####### module tbl #######################################
  1581. .\" This module is copied from groff_ms and modified for mgm.
  1582. .\" Yes, it does not resemble the original anymore :-).
  1583. .\" Don't know if I missed something important.
  1584. .\" Groff_ms is written by James Clark.
  1585. .nr tbl*have-header 0
  1586. .nr tbl*header-written 0
  1587. .de TS
  1588. .br
  1589. .if ''\\n[.z]' .SP
  1590. .if '\\$1'H' .di tbl*header-div
  1591. ..
  1592. .de tbl@top-hook
  1593. .if \\n[tbl*have-header] \{\
  1594. .    ie \\n[.t]-\\n[tbl*header-ht]-1v .tbl@print-header
  1595. .    el .sp \\n[.t]u
  1596. .\}
  1597. ..
  1598. .de tbl@bottom-hook
  1599. .if \\n[tbl*have-header] \{\
  1600. .    nr T. 1
  1601. .\" draw bottom and side lines of boxed tables.
  1602. .    T#
  1603. .\}
  1604. .nr tbl*header-written 0
  1605. ..
  1606. .de tbl@print-header
  1607. .ev tbl*ev
  1608. 'nf
  1609. .tbl*header-div
  1610. .ev
  1611. .mk #T
  1612. .nr tbl*header-written 1
  1613. ..
  1614. .de TH
  1615. .ie '\\n[.z]'tbl*header-div' \{\
  1616. .    nr T. 0
  1617. .    T#
  1618. .    br
  1619. .    di
  1620. .    nr tbl*header-ht \\n[dn]
  1621. .    ne \\n[dn]u+1v
  1622. .    nr tbl*have-header 1
  1623. .    ie '\\$1'N' .if !\\n[tbl*header-written] .tbl@print-header
  1624. .    el .tbl@print-header
  1625. .\}
  1626. .el .@error ".TH without .TS H"
  1627. ..
  1628. .de TE
  1629. .ie '\\n(.z'tbl*header-div' .@error ".TS H but no .TH before .TE"
  1630. .el \{\
  1631. .    nr tbl*have-header 0
  1632. .\}
  1633. .\" reset tabs
  1634. .TAB
  1635. ..
  1636. .de T&
  1637. ..
  1638. .\" ####### module pic #######################################
  1639. .de PS
  1640. .nr pic*in 0
  1641. .br
  1642. .SP .5
  1643. .ie \\n[.$]<2 .@error "PS: bad arguments. Probably not processed with pic."
  1644. .el \{\
  1645. .    if !\\n[ds*lvl] .ne (u;\\$1)+1v
  1646. .\" should be contained between .DS/.DE
  1647. .if r ds*format \{\
  1648. .        if \\n[ds*lvl]&((\\n[ds*format]=2):(\\n[ds*format]=3)) \{\
  1649. .            nr pic*in \\n[.i]
  1650. .\" .        in +(u;\\n[.l]-\\n[.i]-\\$2/2)
  1651. .        \}
  1652. .    \}
  1653. .\}
  1654. ..
  1655. .de PE
  1656. .init@reset
  1657. .SP .5
  1658. ..
  1659. .\" ####### module eq #######################################
  1660. .\" 
  1661. .nr eq*number 0 1
  1662. .de EQ
  1663. .ds eq*lable "\\$1
  1664. .di eq*div
  1665. .misc@ev-keep eq*ev
  1666. .in 0
  1667. .nf
  1668. ..
  1669. .de EN
  1670. .br
  1671. .di
  1672. .ta
  1673. .\" equation with lable.
  1674. .if \\n[dl] \{\
  1675. .    br
  1676. .    chop eq*div
  1677. .    ie (\\n[Eq]%2) \{\
  1678. .        \"    lable to the left
  1679. .        if \\n[ds*format]<2 \{\
  1680. .            ta (u;(\\n[.l]/7)+\\n[.i]) \\n[.l]u\" L
  1681. \\*[eq*lable]\t\\*[eq*div]\t\&
  1682. .        \}
  1683. .        if (\\n[ds*format]=2):(\\n[ds*format]=3) \{\
  1684. .            ta (u;(\\n[.l]-\\n[.i])/2+\\n[.i])C \\n[.l]u\" C
  1685. \\*[eq*lable]\t\\*[eq*div]\t\&
  1686. .        \}
  1687. .        if \\n[ds*format]>3 \{\
  1688. .            ta \\n[.l]uR\"    R
  1689. \\*[eq*lable]\t\\*[eq*div]
  1690. .        \}
  1691. .    \}
  1692. .    el \{\
  1693. .        \"    lable to the right
  1694. .        if \\n[ds*format]<2 \{\
  1695. .            ta \\n[.l]uR\" L
  1696. \\*[eq*div]\t\\*[eq*lable]
  1697. .        \}
  1698. .        if (\\n[ds*format]=2):(\\n[ds*format]=3) \{\
  1699. .            ta (u;(\\n[.l]-\\n[.i])/2+\\n[.i])C \\n[.l]uR\" C
  1700. \t\\*[eq*div]\t\\*[eq*lable]
  1701. .        \}
  1702. .        if \\n[ds*format]>3 \{\
  1703. .            ta (\\n[.l]u-\w'\\*[eq*lable]'u-1m)R \\n[.l]uR\" R
  1704. \t\\*[eq*div]\t\\*[eq*lable]
  1705. .        \}
  1706. .    \}
  1707. .\}
  1708. .TAB
  1709. .ev
  1710. ..
  1711. .\"########### module toc ###################
  1712. .\" table of contents
  1713. .nr toc*slevel 1
  1714. .nr toc*spacing 1v/2u
  1715. .nr toc*tlevel 2
  1716. .nr toc*tab 0
  1717. .\"-----------
  1718. .\" Table of contents with friends (module lix)
  1719. .de TC
  1720. .br
  1721. .\" print any pending displays
  1722. .pg@end-of-text
  1723. .if \w'\\$1'>0 .nr toc*slevel \\$1
  1724. .if \w'\\$2'>0 .nr toc*spacing \\$2v/2u
  1725. .if \w'\\$3'>0 .nr toc*tlevel \\$3
  1726. .if \w'\\$4'>0 .nr toc*tab \\$4
  1727. .if \\n[pg*cols-per-page]>1 .1C
  1728. .pg@clear-hd
  1729. .pg@next-page
  1730. .pg@clear-ft
  1731. .\"-------------
  1732. .if d Ci .toc@read-Ci \\*[Ci]
  1733. .nf
  1734. .in 0
  1735. .nr toc*pn 0 1
  1736. .af toc*pn i
  1737. .PF "''\\\\\\\\n+[toc*pn]''"
  1738. .nr toc*i 4 1
  1739. .while \\n+[toc*i]<10 \{\
  1740. .    if !'\\$\\n[toc*i]'' \{\
  1741. .        ce
  1742. \\$\\n[toc*i]
  1743. .        br
  1744. .    \}
  1745. .\}
  1746. .if \\n[.$]<=4 .if d TX .TX
  1747. .ie d TY .if \\n[.$]<=4 .TY
  1748. .el \{\
  1749. .    ce
  1750. \\*[Licon]
  1751. .    br
  1752. .    SP 3
  1753. .\}
  1754. .toc*list
  1755. .\" print LIST OF XXX
  1756. .if d lix*dsfg .lix@print-ds fg "\\*[Lf]"
  1757. .if d lix*dstb .lix@print-ds tb "\\*[Lt]"
  1758. .if d lix*dsec .lix@print-ds ec "\\*[Le]"
  1759. .if d lix*dsex .lix@print-ds ex "\\*[Lx]"
  1760. ..
  1761. .\"-----------
  1762. .\" .toc@read-Ci lev1 lev2 lev3 lev4 ... lev7
  1763. .de toc@read-Ci
  1764. .nr toc*i 0 1
  1765. .while \\n+[toc*i]<8 \{\
  1766. .    nr toc*hl!\\n[toc*i] \\$\\n[toc*i]
  1767. .\}
  1768. ..
  1769. .\"-----------
  1770. .de toc@save
  1771. .\" collect maxsize of mark if string Ci don't exist.
  1772. .if !d Ci \{\
  1773. .    if !r toc*hl!\\$1 .nr toc*hl!\\$1 0
  1774. .    if \\n[toc*hl!\\$1]<\w'\\$2' \{\
  1775. .        nr toc*hl!\\$1 \w'\\$2'u+1m
  1776. .    \}
  1777. .\}
  1778. .am toc*list
  1779. .\" .toc@set level headernumber text pagenr
  1780. .toc@set \\$1 "\\$2" "\\$3" \\$4
  1781. \\..
  1782. ..
  1783. .\"-----------
  1784. .\" level mark text pagenumber
  1785. .de toc@set
  1786. .if \\$1<=\\n[toc*slevel] .SP \\n[toc*spacing]u
  1787. .ne 2v
  1788. .na
  1789. .fi
  1790. .nr toc*ind 0
  1791. .nr toc*i 0 1
  1792. .ie d Ci \{\
  1793. .    nr toc*ind +\\n[toc*hl!\\$1]u
  1794. .\}
  1795. .el \{\
  1796. .    while \\n+[toc*i]<\\$1 \{\
  1797. .        nr toc*ind +\\n[toc*hl!\\n[toc*i]]u
  1798. .    \}
  1799. .\}
  1800. .nr toc*text \\n[toc*ind]u+\\n[toc*hl!\\$1]u
  1801. .in \\n[toc*text]u
  1802. .ti -\\n[toc*hl!\\$1]u
  1803. .\"
  1804. .\" length of headernum space
  1805. .nr toc*i \\n[toc*hl!\\$1]-\w'\\$2'
  1806. .\"
  1807. .ll \\n[@ll]u-\w'\\$4'u-2m
  1808. .\" ragged right ---------------------------------
  1809. .ie \\$1>\\n[toc*tlevel] \{\
  1810. \\$2
  1811. .    sp -1
  1812. \\$3\ \ \ \\$4
  1813. .    br
  1814. .\}
  1815. .el \{\
  1816. .    \" unnumbered heading --------------------
  1817. .    ie '\\$2'' \{\
  1818. .        in \\n[toc*ind]u
  1819. \\$3\h'1m'
  1820. .    \}
  1821. .    \" normal heading ------------------------
  1822. .    el \{\
  1823. \\$2
  1824. .        sp -1
  1825. \\$3\h'1m'
  1826. .    \}
  1827. .    ll \\n[@ll]u
  1828. .    sp -1
  1829. .    nr toc*sep (u;\\n[.l]-\\n[.n]-\\n[.i]-\w'\\$4')-1m
  1830. \h'|\\n[.n]u'\l'\\n[toc*sep]u.'\h'1m'\\$4
  1831. .\}
  1832. .ll \\n[@ll]u
  1833. ..
  1834. .\"########################### module lix ############################
  1835. .\" LIST OF figures, tables, exhibits and equations 
  1836. .nr lix*fg-nr 0 1
  1837. .nr lix*tb-nr 0 1
  1838. .nr lix*ec-nr 0 1
  1839. .nr lix*ex-nr 0 1
  1840. .aln Fg lix*fg-nr
  1841. .aln Tb lix*tb-nr
  1842. .aln Ec lix*ec-nr
  1843. .aln Ex lix*ex-nr
  1844. .\"------------
  1845. .de FG
  1846. .lix@print-line fg Lf \\n+[lix*fg-nr] "\\$1" "\\$2" "\\$3" "\\$4"
  1847. ..
  1848. .de TB
  1849. .lix@print-line tb Lt \\n+[lix*tb-nr] "\\$1" "\\$2" "\\$3" "\\$4"
  1850. ..
  1851. .de EC
  1852. .lix@print-line ec Le \\n+[lix*ec-nr] "\\$1" "\\$2" "\\$3" "\\$4"
  1853. ..
  1854. .de EX
  1855. .lix@print-line ex Lx \\n+[lix*ex-nr] "\\$1" "\\$2" "\\$3" "\\$4"
  1856. ..
  1857. .\"------------
  1858. .\" print line with 'figure' in the text
  1859. .\" type stringvar number text override flag refname
  1860. .de lix@print-line
  1861. .ds lix*text "\\$4
  1862. .ie !\\n[Of] .ds lix*ds-form .\ \ \"
  1863. .el .ds lix*ds-form "\ \(em\ \"
  1864. .nr lix*in \\n[.i]
  1865. .ds lix*lable \\*[Li\\$1]\ \\$3\\*[lix*ds-form]
  1866. .if !'\\$5'' \{\
  1867. .    if !0\\$6 .ds lix*lable \\*[Li\\$1]\ \\$5\\$3\\*[lix*ds-form]
  1868. .    if 0\\$6=1 .ds lix*lable \\*[Li\\$1]\ \\$3\\$5\\*[lix*ds-form]
  1869. .    if 0\\$6=2 .ds lix*lable \\*[Li\\$1]\ \\$5\\*[lix*ds-form]
  1870. .\}
  1871. .ds lix*pgnr \\n[%]
  1872. .\" print line if not between DS/DE
  1873. .ie \\n[ds*lvl]<1 .lix@print-text "\\*[lix*lable]" "\\*[lix*text]"
  1874. .el .lix@embedded-text "\\*[lix*lable]" "\\*[lix*text]"
  1875. .\"
  1876. .\" save line for LIST OF XXX
  1877. .if !r lix*wth\\$1 .nr lix*wth\\$1 0
  1878. .if \w'\\*[lix*lable]'>\\n[lix*wth\\$1] .nr lix*wth\\$1 \w'\\*[lix*lable]'
  1879. .if \\n[\\$2] .lix@ds-save \\$1 \\*[lix*pgnr] "\\$4" "\\*[lix*lable]"
  1880. .if !'\\$7'' .SETR \\$7 \\$3
  1881. ..
  1882. .\"-----------
  1883. .de lix@print-text
  1884. .SP \\n[Lsp]u
  1885. .misc@ev-keep lix
  1886. .init@reset
  1887. .br
  1888. .ie (\w'\\$1\\$2')>(\\n[.l]-\\n[.i]) \{\
  1889. .    in +\w'\\$1'u
  1890. .    ti 0
  1891. .\}
  1892. .el .ce 1
  1893. \fB\\$1\fP\\$2
  1894. .br
  1895. .ev
  1896. ..
  1897. .\" hide printout until diversion is evaluated
  1898. .de lix@embedded-text
  1899. \!.SP \\n[Lsp]u
  1900. \!.misc@ev-keep lix
  1901. \!.init@reset
  1902. \!.br
  1903. \!.ie (\w'\\$1\\$2')>(\\n[.l]-\\n[.i]) \{\
  1904. \!.    in +\w'\\$1'u
  1905. \!.    ti 0
  1906. \!.\}
  1907. \!.el .ce 1
  1908. \!\fB\\$1\fP\\$2
  1909. \!.br
  1910. \!.ev
  1911. ..
  1912. .\"------------
  1913. .\" print complete list of XXXX
  1914. .de lix@print-ds
  1915. .\" arg: fg,tb,ec,ex text
  1916. .if !\\n[Cp] .pg@next-page
  1917. .\" print LIST OF XXXX
  1918. .ce
  1919. \\$2
  1920. .SP 3
  1921. .in \\n[lix*wth\\$1]u
  1922. .fi
  1923. .lix*ds\\$1
  1924. ..
  1925. .\"------------
  1926. .\" save line of list in macro
  1927. .de lix@ds-save
  1928. .\" type pagenumber text
  1929. .am lix*ds\\$1
  1930. .lix@dsln \\$1 \\$2 "\\$3" "\\$4" \\$5
  1931. \\..
  1932. ..
  1933. .\"------------
  1934. .\" print appended macro
  1935. .\" lix@dsln type pagenumber text headernr
  1936. .de lix@dsln
  1937. .nr lix*i \\n[lix*wth\\$1]-\w'\\$4'
  1938. .ne 2v
  1939. .ll -4m
  1940. .ti 0
  1941. \h'\\n[lix*i]u'\\$4\\$3
  1942. .sp -1
  1943. .ll
  1944. .ti \\n[.l]u-\w'\\$2'u
  1945. \\$2
  1946. ..
  1947. .\"########################### module fnt ############################
  1948. .\" some font macros.
  1949. .de R
  1950. .ft R
  1951. .ul 0
  1952. ..
  1953. .\"-----------
  1954. .de fnt@switch
  1955. .ul 0
  1956. .ds fnt*tmp
  1957. .nr fnt*prev \\n[.f]
  1958. .nr fnt*i 2 1
  1959. .while \\n+[fnt*i]<=\\n[.$] \{\
  1960. .    if \\n[fnt*i]>3 .as fnt*tmp \,
  1961. .    ie (\\n[fnt*i]%2)=1 .as fnt*tmp \\$1\\$[\\n[fnt*i]]
  1962. .    el .as fnt*tmp \\$2\\$[\\n[fnt*i]]
  1963. .    if \\n[fnt*i]<\\n[.$] .as fnt*tmp \/
  1964. .\}
  1965. \\*[fnt*tmp]\f[\\n[fnt*prev]]
  1966. ..
  1967. .\"-----------
  1968. .de B
  1969. .ie \\n[.$] .fnt@switch \fB \f[\\n[.f]] \\$@
  1970. .el .ft B
  1971. ..
  1972. .de I
  1973. .ie \\n[.$] .fnt@switch \fI \f[\\n[.f]] \\$@
  1974. .el .ft I
  1975. ..
  1976. .de IB
  1977. .if \\n[.$] .fnt@switch \fI \fB \\$@
  1978. ..
  1979. .de BI
  1980. .if \\n[.$] .fnt@switch \fB \fI \\$@
  1981. ..
  1982. .de IR
  1983. .if \\n[.$] .fnt@switch \fI \fR \\$@
  1984. ..
  1985. .de RI
  1986. .if \\n[.$] .fnt@switch \fR \fI \\$@
  1987. ..
  1988. .de RB
  1989. .if \\n[.$] .fnt@switch \fR \fB \\$@
  1990. ..
  1991. .de BR
  1992. .if \\n[.$] .fnt@switch \fB \fR \\$@
  1993. ..
  1994. .\"########################### module box ############################
  1995. .\" draw a box around some text. Text will be kept on the same page.
  1996. .\"
  1997. .nr box*ll 0
  1998. .\" .B1 and .B2 works like .DS
  1999. .de B1
  2000. .if \\n[box*ll] .@error "B1: missing B2"
  2001. .nr box*ll \\n[.l]
  2002. .nr box*ind \\n[.i]
  2003. .nr box*hyp \\n[.hy]
  2004. .in +1n
  2005. .ll -1n
  2006. .di box*div
  2007. .hy \\n[.hy]
  2008. ..
  2009. .de B2
  2010. .if !\\n[box*ll] .@error "B2: missing B1"
  2011. .br
  2012. .di
  2013. .nr box*height \\n[dn]
  2014. .ne \\n[dn]u+1v
  2015. .ev box*ev
  2016. .ll \\n[box*ll]u
  2017. .in 0
  2018. .nr box*y-pos \\n[.d]u
  2019. .nf
  2020. .box*div
  2021. .fi
  2022. \v'-1v+.25m'\
  2023. \D'l \\n[.l]u 0'\
  2024. \D'l 0 -\\n[box*height]u'\
  2025. \D'l -\\n[.l]u 0'\
  2026. \D'l 0 \\n[box*height]u'
  2027. .br
  2028. .sp -1
  2029. .ev
  2030. .sp .20v
  2031. .in \\n[box*ind]u
  2032. .ll \\n[box*ll]u
  2033. .rm box*div
  2034. .nr box*ll 0
  2035. ..
  2036. .\"########################### module ref ############################
  2037. .nr ref*nr 0 1
  2038. .nr ref*nr-width 5n
  2039. .ds Rf \v'-.4m'\s-3[\\n+[ref*nr]]\s0\v'.4m'
  2040. .\" start reference
  2041. .de RS
  2042. .if !''\\$1' .ds \\$1 \\n[ref*nr]
  2043. .ev ref*ev
  2044. .da ref*div
  2045. .init@reset
  2046. .ll \\n[@ll]u
  2047. .in \\n[ref*nr-width]u
  2048. .ti -(\w'\\n[ref*nr].'u+1n)
  2049. \\n[ref*nr].
  2050. .sp -1
  2051. ..
  2052. .de RF
  2053. .br
  2054. .if \\n[Ls] .SP .5
  2055. .di
  2056. .ev
  2057. ..
  2058. .de RP
  2059. .if !d ref*div .@error "RP: No references!"
  2060. .nr ref*i 0\\$2
  2061. .if \\n[ref*i]<2 .SK
  2062. .SP 2
  2063. .toc@save 1 "" "\\*[Rp]" \\n[%]
  2064. .ev ref*ev
  2065. .ce
  2066. \fI\\*[Rp]\fP
  2067. .sp
  2068. .in 0
  2069. .nf
  2070. .ref*div
  2071. .in
  2072. .if 0\\$1<1 .nr ref*nr 0 1
  2073. .rm ref*div
  2074. .ev
  2075. .if (\\n[ref*i]=0:\\n[ref*i]=2) .SK
  2076. ..
  2077. .\"########################### module app ############################
  2078. .\" 
  2079. .nr app*nr 0 1
  2080. .af app*nr A
  2081. .nr app*dnr 0 1
  2082. .\"------------
  2083. .\" .APP name text
  2084. .\" name == "" -> autonumber
  2085. .de APP
  2086. .if \\n[.$]<2 .@error "APP: too few arguments"
  2087. .app@set-ind "\\$1"
  2088. .\"
  2089. .ie \\n[Aph] .app@header \\*[app*ind] "\\$2"
  2090. .el .bp
  2091. .app@index "\\*[app*ind]" "\\$2"
  2092. ..
  2093. .\"------------
  2094. .\" .APPSK name pages text
  2095. .\" name == "" -> autonumber
  2096. .de APPSK
  2097. .if \\n[.$]<2 .@error "APPSK: too few arguments"
  2098. .app@set-ind "\\$1"
  2099. .\"
  2100. .ie \\n[Aph] .app@header \\*[app*ind] "\\$3"
  2101. .el .bp
  2102. .app@index "\\*[app*ind]" "\\$3"
  2103. .pn +\\$2
  2104. ..
  2105. .\"------------
  2106. .de app@set-ind
  2107. .ie \w'\\$1' .ds app*ind \\$1
  2108. .el \{\
  2109. .    if !\\n[app*dnr] \{\
  2110. .        nr H1 0 1
  2111. .        af H1 A
  2112. .    \}
  2113. .    ds app*ind \\n+[app*nr]
  2114. .    nr H1 \\n+[app*dnr]
  2115. .\}
  2116. .\"    clear lower counters
  2117. .nr app*i 1 1
  2118. .while \\n+[app*i]<8 .nr H\\n[app*i] 0 1
  2119. ..
  2120. .\"------------
  2121. .de app@index
  2122. .toc@save 1 "" "\\*[App] \\$1: \\$2" \\n[%]
  2123. ..
  2124. .\"------------
  2125. .\" app@heaer name text
  2126. .de app@header
  2127. .bp
  2128. .SP \\n[Lsp]u*4u
  2129. .ce 1
  2130. \s+4\fB\\*[App]\ \\$1\fP\s0
  2131. .SP \\n[Lsp]u*2u
  2132. .if \w'\\$2'<\\n[.l] .ce 1
  2133. \fB\s+2\\$2\s0\fP
  2134. .SP \\n[Lsp]u*4u
  2135. ..
  2136. .\"########################### module cov ############################
  2137. .\" title stored in diversion cov*title
  2138. .\" abstract stored in diversion cov*abstract
  2139. .\"    arg to abstract stored in cov*abs-arg
  2140. .\"    indent stored in cov*abs-ind
  2141. .\" number of authors stored in cov*au
  2142. .\" author(s) stored in cov*au!x!y
  2143. .\" author(s) title stored in cov*at!x!y
  2144. .\"     x is the author-index [1-cov*au], y is the argument-index [1-9].
  2145. .\" author(s) firm stored in cov*firm
  2146. .\" new date (if .ND exists) is stored in cov*new-date
  2147. .\"
  2148. .\"
  2149. .ds cov*abs-name ABSTRACT
  2150. .\"
  2151. .nr cov*au 0
  2152. .de TL
  2153. .if \\n[.$]>0 .ds cov*title-charge-case \\$1
  2154. .if \\n[.$]>1 .ds cov*title-file-case \\$2
  2155. .pg@disable-top-trap
  2156. .eo
  2157. .de cov*title AU
  2158. ..
  2159. .\"-------------------
  2160. .de cov@title-end
  2161. .ec
  2162. ..
  2163. .\"-------------------
  2164. .\" .AU name [initials [loc [dept [ext [room [arg [arg [arg]]]]]]]]
  2165. .de AU
  2166. .cov@title-end
  2167. .pg@disable-top-trap
  2168. .if \\n[.$]<1 .@error "AU: no arguments"
  2169. .nr cov*au +1
  2170. .nr cov*i 0 1
  2171. .while \\n[.$]>=\\n+[cov*i] \{\
  2172. .    ds cov*au!\\n[cov*au]!\\n[cov*i] "\\$[\\n[cov*i]]
  2173. .\}
  2174. .if (\\n[.$]>=3)&(\w'\\$3') \{\
  2175. .    if d cov*location-\\$3] \{\
  2176. .        ds cov*au!3!\\n[cov*au] \\*[cov*location-\\$3]
  2177. .    \}
  2178. .\}
  2179. ..
  2180. .\"-------------------
  2181. .\" .AT title1 [title2 [... [title9] ]]]]
  2182. .\" Well, thats all that COVEND look for.
  2183. .\" Must appear directly after .AU
  2184. .de AT
  2185. .if \\n[.$]<1 .@error "AT: no arguments"
  2186. .nr cov*i 0 1
  2187. .while \\n[.$]>=\\n+[cov*i] \{\
  2188. .    ds cov*at!\\n[cov*au]!\\n[cov*i] "\\$[\\n[cov*i]]
  2189. .\}
  2190. ..
  2191. .\"-------------------
  2192. .de AF
  2193. .cov@title-end
  2194. .if \\n[.$]<1 .@error "AF: no arguments"
  2195. .ds cov*firm \\$1
  2196. ..
  2197. .de AST
  2198. .ds cov*abs-name \\$1
  2199. ..
  2200. .de AS
  2201. .pg@disable-top-trap
  2202. .if d cov*abstract .@error "AS: only one abstract allowed"
  2203. .if !''\\n[.z]' .@error "AS: no diversion allowed (previous .AS?)"
  2204. .nr cov*abs-arg 0\\$1
  2205. .nr cov*abs-ind (n;0\\$2)
  2206. .de cov*abstract AE
  2207. ..
  2208. .de AE
  2209. ..
  2210. .\" I am planning to use mgm some time :-)
  2211. .ie \\n[yr]<50 .ds cov*new-date \\*[MO\\n[mo]] \\n[dy], 20\\n[yr]
  2212. .el .ds cov*new-date \\*[MO\\n[mo]] \\n[dy], 19\\n[yr]
  2213. .als DT cov*new-date
  2214. .de ND
  2215. .\" don't remember why I did this: .pg@disable-top-trap
  2216. .ds cov*new-date \\$1
  2217. ..
  2218. .\"-------------------
  2219. .\" save technical numbers.
  2220. .de TM
  2221. .nr cov*i 0 1
  2222. .while \\n[.$]>=\\n+[cov*i] .ds cov*mt-tm!\\n[cov*i] \\$[\\n[cov*i]]
  2223. .nr cov*mt-tm-max \\n[.$]
  2224. ..
  2225. .\"-----------------------
  2226. .\" cover sheet
  2227. .\" the file must have the following last lines (somewhere):
  2228. .\" .pg@enable-top-trap
  2229. .\" .bp 1
  2230. .\" .pg@enable-trap
  2231. .ds cov*mt-file!0 0.MT
  2232. .ds cov*mt-file!1 0.MT
  2233. .ds cov*mt-file!2 0.MT
  2234. .ds cov*mt-file!3 0.MT
  2235. .ds cov*mt-file!4 4.MT
  2236. .ds cov*mt-file!5 5.MT
  2237. .ds cov*mt-file!6 0.MT
  2238. .\"------------
  2239. .de MT
  2240. .ie \\n[.$] \{\
  2241. .    ie d cov*mt-file!\\$1 .ds cov*mt-type \\$1
  2242. .    el .ds cov*mt-type 6
  2243. .\}
  2244. .el .ds cov*mt-type 1
  2245. .ds cov*mt-addresse "\\$2
  2246. .ds cov*mt-type-text "\\$1
  2247. .ie d @language .ds cov*str mm/\\*[@language]_
  2248. .el .ds cov*str mm/
  2249. .mso \\*[cov*str]\\*[cov*mt-file!\\*[cov*mt-type]]
  2250. ..
  2251. .de COVER
  2252. .ie !\\n[.$] .ds cov*cov-type ms
  2253. .el .ds cov*cov-type \\$1
  2254. .pg@disable-top-trap
  2255. .ie d @language .ds cov*str mm/\\*[@language]_\\*[cov*cov-type].cov
  2256. .el .ds cov*str mm/\\*[cov*cov-type].cov
  2257. .mso \\*[cov*str]
  2258. ..
  2259. .\"########################### module qrf ############################
  2260. .\" forward and backward reference thru special files.
  2261. .\"
  2262. .\" init reference system
  2263. .de INITR
  2264. .if \\n[.$]<1 .@error "INITR:filename missing"
  2265. .\" ignore if INITR has already been used
  2266. .if !r qrf*pass \{\
  2267. .\"
  2268. .    ds qrf*file \\$1
  2269. .    sy test -f \\*[qrf*file].tmp
  2270. .    ie \\n[systat] \{\
  2271. .        \" PASS 1
  2272. .        if \\n[D]=1 .tm PASS 1
  2273. .        if \\n[D]>1 .tm INITR: file \\*[qrf*file].tmp, PASS 1
  2274. .        nr qrf*pass 1
  2275. .        open qrf*stream \\*[qrf*file].tmp
  2276. .        write qrf*stream .\\\\" references for \\*[qrf*file]
  2277. .        close qrf*stream
  2278. .    \}
  2279. .    el \{\
  2280. .        nr qrf*pass 2
  2281. .        if \\n[D]=1 .tm PASS 2
  2282. .        if \\n[D]>1 .tm INITR: file \\*[qrf*file].tmp, PASS 2
  2283. .        sy mv  \\*[qrf*file].tmp  \\*[qrf*file].qrf
  2284. '        so  \\*[qrf*file].qrf
  2285. .    \}
  2286. .\}
  2287. ..
  2288. .\"---------------
  2289. .\" set a reference.
  2290. .de SETR
  2291. .if \\n[.$]<1 .@error "SETR:reference name missing"
  2292. .ie !r qrf*pass .tm "SETR: No .INITR in this file"
  2293. .el \{\
  2294. .    ds qrf*name qrf*ref-\\$1
  2295. .\" probably pass two if already defined
  2296. .    if \\n[qrf*pass]<2 \{\
  2297. .        if \\n[D]>2 .tm SETR: ref \\*[qrf*name]=\\*[hd*toc-mark],\\n[%]
  2298. .        \" heading-number
  2299. .        ds \\*[qrf*name]-hn \\*[hd*toc-mark]
  2300. .        \" page-number
  2301. .        ds \\*[qrf*name]-pn \\n[%]
  2302. .        \"
  2303. .        \" append to file
  2304. .        opena qrf*stream \\*[qrf*file].tmp
  2305. .        write qrf*stream .ds \\*[qrf*name]-hn \\*[hd*toc-mark]
  2306. .        write qrf*stream .ds \\*[qrf*name]-pn \\n[%]
  2307. .        if !'\\$2'' .write qrf*stream .ds \\*[qrf*name]-xx \\$2
  2308. .        close qrf*stream
  2309. .    \}
  2310. .\}
  2311. ..
  2312. .\"---------------
  2313. .\" get misc-string, output <->42<-> in pass 1
  2314. .\" If two arg -> set var. arg to misc-string.
  2315. .de GETST
  2316. .if \\n[.$]<1 .@error "GETST:reference name missing"
  2317. .if !r qrf*pass .tm "GETST: No .INITR in this file"
  2318. .ds qrf*name qrf*ref-\\$1
  2319. .ie \\n[qrf*pass]=2 \{\
  2320. .    ie !d \\*[qrf*name]-xx .tm "GETHN:\\$1 not defined"
  2321. .    el \{\
  2322. .        ie \\n[.$]>1 .ds \\$2 \\*[\\*[qrf*name]-xx]
  2323. .        el \\*[\\*[qrf*name]-xx]\c
  2324. .    \}
  2325. .\}
  2326. .\" The answer...
  2327. .el <->42<->\c
  2328. ..
  2329. .\"---------------
  2330. .\" get header-number, output X.X.X. in pass 1
  2331. .\" If two arg -> set var. arg to header-number.
  2332. .de GETHN
  2333. .if \\n[.$]<1 .@error "GETHN:reference name missing"
  2334. .if !r qrf*pass .tm "GETHN: No .INITR in this file"
  2335. .ds qrf*name qrf*ref-\\$1
  2336. .ie \\n[qrf*pass]=2 \{\
  2337. .    ie !d \\*[qrf*name]-hn .tm "GETHN:\\$1 not defined"
  2338. .    el \{\
  2339. .        ie \\n[.$]>1 .ds \\$2 \\*[\\*[qrf*name]-hn]
  2340. .        el \\*[\\*[qrf*name]-hn]\c
  2341. .    \}
  2342. .\}
  2343. .el X.X.X.\c
  2344. ..
  2345. .\"---------------
  2346. .\" get page-number, output 9999 in pass 1
  2347. .\" If two arg -> set var. arg to page-number.
  2348. .de GETPN
  2349. .if \\n[.$]<1 .@error "GETPN:reference name missing"
  2350. .if !r qrf*pass .tm "GETPN: No .INITR in this file"
  2351. .ds qrf*name qrf*ref-\\$1
  2352. .ie \\n[qrf*pass]=2 \{\
  2353. .    ie !d \\*[qrf*name]-pn .tm "GETPN:\\$1 not defined"
  2354. .    el \{\
  2355. .        ie \\n[.$]>1 .ds \\$2 \\*[\\*[qrf*name]-pn]
  2356. .        el \\*[\\*[qrf*name]-pn]\c
  2357. .    \}
  2358. .\}
  2359. .el 9999\c
  2360. ..
  2361. .\"----------
  2362. .de GETR
  2363. .if \\n[.$]<1 .@error "GETR:reference name missing"
  2364. .ie !r qrf*pass \{\
  2365. .    tm "GETR: No .INITR in this file"
  2366. .\}
  2367. .el \{\
  2368. .    if \\n[qrf*pass]=2 \{\
  2369. .        GETHN \\$1 Qrfh
  2370. .        GETPN \\$1 Qrfp
  2371. \\*[Qrf]
  2372. .    \}
  2373. .\}
  2374. ..
  2375.